[futurebasic] Re: The Rosetta Stone

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2001 : Group Archive : Group : All Groups

From: Ken Shmidheiser <k.shmidheiser@...>
Date: Wed, 17 Oct 2001 22:48:32 -0400
Many programming languages contain a StrReverse function to allow the 
programmer to quickly reverse the characters in a given string. This 
can be useful in creating passwords, games and for other things 
limited only the the imagination.

Ken

Here is a StrReverse clone in FB:

'~StrReverse Clone (reverses a string)

LOCAL FN StrReverse$( inputStr AS STR255 )
DIM AS STR255 revStr
DIM AS INTEGER i

revStr = ""
For i = 1 To inputStr[0]
revStr = revStr + LEFT$( RIGHT$( inputStr, i), 1)
NEXT i

END FN = revStr

DIM myStr AS STR255

myStr = " Hello, how are you?"

PRINT:Print "FN StrReverse$ reversed the letters this string:"
PRINT FN StrReverse$( myStr )