Results 1 to 8 of 8

Thread: Inverse Text

  1. #1

    Thread Starter
    Addicted Member articwoof's Avatar
    Join Date
    Oct 2004
    Location
    Alaska
    Posts
    163

    Inverse Text

    I like to make text art and know you can invert/flip horzitonaly a picture but is it possible to invert/flip horzitonal:
    \\\\\\\\\\\\\\\\\
    to:
    /////////////////


    123456789
    987654321

    or any other characters
    Thanks in advanced!
    [+] - My Portfolio/Blog :: RattleSoft

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Inverse Text

    You can use StrRev() to reverse a string. It won't do anything with "\\\\\" though. You'd have to replace() "\" with "/" for that.
    VB Code:
    1. text1.text = StrRev(text1.text)
    Last edited by dglienna; Jun 20th, 2005 at 08:11 PM.

  3. #3
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Inverse Text

    Text2.Text = StrReverse(Text1.Text)

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Inverse Text

    Quote Originally Posted by dglienna
    You can use InstrRev() to reverse a string. It won't do anything with "\\\\\" though. You'd have to replace() "\" with "/" for that.
    VB Code:
    1. text1.text = InstrRev(text1.text)
    InStrRev is the same as InStr, just it goes from right to left to find the specified string in a given string.

    I think you meant to say StrReverse

  5. #5

    Thread Starter
    Addicted Member articwoof's Avatar
    Join Date
    Oct 2004
    Location
    Alaska
    Posts
    163

    Re: Inverse Text

    With StrReverse I get some messed up display:
    a54321fedcba987654321fedc
    a

    In the textbox it displays as: a54321fedcba987654321fedca
    when it should say: a54321fedcba987654321fedc without a
    On the line it displays the lettter of the next line on the previous line
    [+] - My Portfolio/Blog :: RattleSoft

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Inverse Text

    Quote Originally Posted by baja_yu
    InStrRev is the same as InStr, just it goes from right to left to find the specified string in a given string.

    I think you meant to say StrReverse
    Oops. You're right. Thanks.

    EDITED: Corrected.

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Inverse Text

    Quote Originally Posted by articwoof
    With StrReverse I get some messed up display:
    a54321fedcba987654321fedc
    a

    In the textbox it displays as: a54321fedcba987654321fedca
    when it should say: a54321fedcba987654321fedc without a
    On the line it displays the lettter of the next line on the previous line
    Post your code. You must have a crlf in the data.

  8. #8
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Inverse Text

    A vbCrLf (enter) is a combination of 2 characters in windows chr(13)+chr(10). So when you do StrReverse, you make it chr(10)+chr(13)
    The following code would work correctly.
    VB Code:
    1. Text2.Text = Replace(StrReverse(Text1.Text), vbLf & vbCr, vbCrLf)
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width