Results 1 to 5 of 5

Thread: turn text backwards (heard it was easy)

  1. #1

    Thread Starter
    Member
    Join Date
    May 2000
    Location
    Mansfield Texas
    Posts
    36
    I remember a long time ago, read how to turn text backwards, but I do't remember how like make 'hello me' into 'em olleh'.
    Charlie Staton
    14 y/o
    I don't smoke, I don't drink, and I don't assosciate with pokemon.

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    If you have VB6 you can use "StrReverse" else you will have to write your own

    Code:
    Function myRev(stString As String) as String
        Dim i as Integer
    
        For i = Len(stString) to 1 Step -1
          myRev = myRev & mid$(stString, i, 1)
        next i
    
    End Function
    
    'call like this
    myStr = myRev("Hello Me")
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    Member
    Join Date
    May 2000
    Location
    Mansfield Texas
    Posts
    36
    thanx lain, but when I try to reverse a multiline textbox, instead of going to the next line, it srews up like I put this text in
    Example:
    Code:
         ----- Interesting Auto Accident Insurance Claims -----
    - Coming home, I drove into the wrong house and collided with a tree which
    I didn't have. 
    - I thought my window was down, but I found it was up when I put my hand
    through it. 
    - I collided with a stationary lorry coming the other way. 
    - A van backed through my windscreen into my wife's face. 
    - A pedestrian hit me and went under my car. 
    - He was all over the road and I had to swerve a number of times before I
    hit him 
    - In an attempt to kill a fly I drove into a tree. 
    - I had been driving my car for forty years when I fell asleep at the
    wheel. 
    - My car was legally parked as it backed into the other vehicle. 
    - An invisible car came out of nowhere, struck my vehicle and vanished. 
    - I told the police that I was not injured, but on removing my hat I found
    that had a fractured skull. 
    - The pedestrian had no idea which direction to go, so I ran over hin. 
    - I saw the slow-moving, sad-faced old gentleman as he hounced off the
    bonnet of my car. 
    - The indirect cause of the accident was the little chap in a small car
    with a moustache. 
    - I was thrown from my car as it left the road. I was later found in a
    ditch by some cows. 
    - The telephone pole was approaching fast and I was attempting to swerve
    out of its path when it struck my car. 
    - I was on the way to the doctor when my rear end gave way, causing me to
    have an accident. 
    - I pulled away from the side of the road, glanced over at mother-in-law
    and drove into the river.
    it comes out as this:
    Code:
    .revir eht otni evord dna
    wal-ni-rehtom ta revo decnalg ,daor eht fo edis eht morf yawa dellup I -
     .tnedicca na evah
    ot em gnisuac ,yaw evag dne raer ym nehw rotcod eht ot yaw eht no saw I -
     .rac ym kcurts ti nehw htap sti fo tuo
    evrews ot gnitpmetta saw I dna tsaf gnihcaorppa saw elop enohpelet ehT -
     .swoc emos yb hctid
    a ni dnuof retal saw I .daor eht tfel ti sa rac ym morf nworht saw I -
     .ehcatsuom a htiw
    rac llams a ni pahc elttil eht saw tnedicca eht fo esuac tceridni ehT -
     .rac ym fo tennob
    eht ffo decnuoh eh sa nameltneg dlo decaf-das ,gnivom-wols eht was I -
     .nih revo nar I os ,og ot noitcerid hcihw aedi on dah nairtsedep ehT -
     .lluks derutcarf a dah taht
    dnuof I tah ym gnivomer no tub ,derujni ton saw I taht ecilop eht dlot I -
     .dehsinav dna elcihev ym kcurts ,erehwon fo tuo emac rac elbisivni nA -
     .elcihev rehto eht otni dekcab ti sa dekrap yllagel saw rac yM -
     .leehw
    eht ta peelsa llef I nehw sraey ytrof rof rac ym gnivird neeb dah I -
     .eert a otni evord I ylf a llik ot tpmetta na nI -
     mih tih
    I erofeb semit fo rebmun a evrews ot dah I dna daor eht revo lla saw eH -
     .rac ym rednu tnew dna em tih nairtsedep A -
     .ecaf s'efiw ym otni neercsdniw ym hguorht dekcab nav A -
     .yaw rehto eht gnimoc yrrol yranoitats a htiw dedilloc I -
     .ti hguorht
    dnah ym tup I nehw pu saw ti dnuof I tub ,nwod saw wodniw ym thguoht I -
     .evah t'ndid I
    hcihw eert a htiw dedilloc dna esuoh gnorw eht otni evord I ,emoh gnimoC -
    ----- smialC ecnarusnI tnediccA otuA gnitseretnI -----
    so, basically, I want to keep the otigional format. Oh, and I have vb6
    Charlie Staton
    14 y/o
    I don't smoke, I don't drink, and I don't assosciate with pokemon.

  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Thats a little trickier.

    Code:
    Private Sub Command1_Click()
        Dim myStAr() As String
        Dim i As Integer
        
        'split the text on carrige returns
        myStAr = Split(Text1.Text, vbCrLf)
        
        'clear the text box
        Text1.Text = ""
        
        For i = 0 To UBound(myStAr)
          'reverse line
          myStAr(i) = StrReverse(myStAr(i))
          'add line back to text box
          Text1.Text = Text1.Text & myStAr(i) & vbCrLf
        Next
        
    End Sub
    Iain, thats with an i by the way!

  5. #5

    Thread Starter
    Member
    Join Date
    May 2000
    Location
    Mansfield Texas
    Posts
    36
    Thanx!
    Charlie Staton
    14 y/o
    I don't smoke, I don't drink, and I don't assosciate with pokemon.

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