[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:46:07 -0400
Many programming languages have an RTRIM function trim to trailing 
spaces from a string. Such a function would be handy in FB to trim 
trailing spaces from strings imported from such things as a database, 
among others.

Here is an RTRIM clone in FB:

'~RTRIM Clone (removes trailing spaces)

LOCAL FN RTRIM$( rTrimStr AS STR255 )

WHILE RIGHT$( rTrimStr,1 ) = " " AND rTrimStr[0] > 0
rTrimStr = LEFT$( rTrimStr, rTrimStr[0]-1 )
WEND

END FN = rTrimStr

DIM myStr AS STR255

myStr = "Hello, how are you?        "'Notice trailing spaces

PRINT:Print "FN RTRIM$ removed the trailing spaces in this string:"
PRINT FN RTRIM$( myStr )