Page 1 of 1

Invert data

PostPosted: Thu Jun 08, 2006 1:44 pm
by Rox_Folder
Hi all,
How are yours? I hope well
My question is if is possible to invert, revert ou mirror, i dont know the exact term, but for example, i my database display a text like...yadot (today) and for the user display the correct text.

more cleary

turn whole texts on my database invert, but display to user with the correct text.

thank you

PostPosted: Thu Jun 08, 2006 2:21 pm
by Sam Cox
String Reverse Character Order
SAM COX NOVEMBER 9, 2003

Usage
Code: Select all
SetVar "[String]" "Reverse Any String"
Gosub "StrReverse"

Result
Code: Select all
[String] = "gnirtS ynA esreveR"

Subroutine
Code: Select all
:StrReverse
..  input [String] to reverse
..  output [String] reversed
If "[String]" "<>" ""
    SetVar "[Temp]" ""
    StrLen "[String]" "[StrLen]"
    Loop "1" "[StrLen]" "[Index]"
        SubStr "[String]" "[Index]" "1" "[Char]"
        SetVar "[Temp]" "[Char][Temp]"
    EndLoop
    SetVar "[String]" "[Temp]"
Endif
Return

PostPosted: Thu Jun 08, 2006 2:46 pm
by Rox_Folder
Thank you mister,

works like a charm, but, basead with your code i try to use my database to display the reverse words but withou sucess

I change the "Reverse Any String" to variable of my database, and nothings happens, i will continue trying my best with the code, if i get right i will post here.

one more time thank you Sam

PostPosted: Sat Jun 10, 2006 11:40 am
by Trainman
Thanks Sam!

I couldn't get my head around how to reverse a string of text either. This line gave me one of those "A-HA!" moments:

Code: Select all
SetVar "[Temp]" "[Char][Temp]"


Thanks,
John

PostPosted: Sat Jun 10, 2006 4:44 pm
by Sam Cox
If you were already using HPW's newLisp plugin — which, by the way, is highly recommended — you could write:
Code: Select all
hpwNewLispCall "(reverse {[String]})" "[Reversed]"

PostPosted: Mon Jun 12, 2006 12:12 am
by Cipolla
Just to make it complete, there is also a (free) plugin called
"RlFunctions" with one action to handle this:

Code: Select all
rlStrRev "[Orig]" "[Rev]"


RlFunctions is a very good plugin with many usefull actions. You could find it here:



http://rlplugins.software-zone.com/