Economy-x-Talk - Sample Scripts
BackWards Linewise and Textwise
Hi all,
How are things going? I wrote a little script to reverse text, i.e. to put it backwards. Here is the script:
function backwardsText theText,lineBool
put empty into newText
if lineBool is true then
repeat with l=1 to number of lines of theText
put backwardsText(line l of theText,false) & return after newText
end repeat
put newText into theText
else
repeat with x=1 to number of chars of theText
put char x of theText into c
delete char x of theText
put c before theText
end repeat
end if
return theText
end backwardsText
You could use this function to reverse a text line by line, or entirely at once.
put backwardsText(<text>,boolean)
where <text> is any container containing text. The boolean is false for textwise reversion and true for linewise reversion.
Best regards,
Mark
on dobackwardsLinewise
put backwardsLinewise(bg fld 1,true) into rslt
return rslt
end dobackwardsLinewise
function backwardsLinewise theText,lineBool
put empty into newText
if lineBool is true then
repeat with l=1 to number of lines of theText
put backwardsLinewise(line l of theText,false) & return after newText
end repeat
put newText into theText
else
repeat with x=1 to number of chars of theText
put char x of theText into c
delete char x of theText
put c before theText
end repeat
end if
return theText
end backwardsLinewise
on dobackwardsTextwise
put backwardsTextwise(bg fld 1,false) into rslt
return rslt
end dobackwardsTextwise
function backwardsTextwise theText,lineBool
put empty into newText
if lineBool is true then
repeat with l=1 to number of lines of theText
put backwardsTextwise(line l of theText,false) & return after newText
end repeat
put newText into theText
else
repeat with x=1 to number of chars of theText
put char x of theText into c
delete char x of theText
put c before theText
end repeat
end if
return theText
end backwardsTextwise
Keep this extensive resource of tutorials and samples on-line! Support RunRev.info!
| Yes, this script is useful. I make a donation and choose freely how much I want to donate on-line (PayPal). Click here if you want to make a donation in dollars. | This script has not (completely) solved my problem and I want Economy-x-Talk to take care of it. Let me contact you. |
Copyright©2002-2008 by Mark Schonewille, Nijmegen, the Netherlands. This web site is in no way affiliated with Runtime Revolution Ltd., but we do recommend the Revolution development platform.