Results 1 to 6 of 6

Thread: [RESOLVED] What's wrong plz? Reversing string

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    69

    Resolved [RESOLVED] What's wrong plz? Reversing string

    Hi all, and thanks in advance

    can you please tell me what is wrong here? I am traying to Reverse a String which is not only backword...it like you look at the String in front of you or like it is in the Mirror. becouse it is in arabic lang. the other problem here it is like bringing the last string with the new one
    1- I want the reverse order for string.

    Do While Not EOF(1)
    Line Input #1, sIN
    For I = Rec_size To 0 Step -1
    T = T & Mid(sIN, 1, 1)
    sIN = Mid(sIN, 2)
    Next I
    Print #2, T
    W = " "
    Loop

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: What's wrong plz? Reversing string

    Have you tried the StrReverse function?
    VB Code:
    1. T = StrReverse(sIn)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    69

    Re: What's wrong plz? Reversing string

    Yes i did and it does not work with it becous i have to go thru the loop like from postion 133 to postion one..my propleam is that itis like the line of string in the wall and you want to go back from right to lift... becouse of some font shape i have to deal with

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    69

    Re: What's wrong plz? Reversing string

    even like the code i post i get now a blind becouse i can not see the stupen mistake i am missing..

  5. #5
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: What's wrong plz? Reversing string

    Can you give an example of the input file and of the wanted outcome?

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: What's wrong plz? Reversing string

    T = T & Mid(sIN, 1, 1)
    That takes the first character of sIN and adds it to T instead of the last. Your code should probably read:
    VB Code:
    1. For I = Rec_size To 1 Step -1
    2.     T = T & Mid(sIN, I, 1) '<- Notice that the second argument uses the I variable instead of 1
    3. Next I

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