[futurebasic] Re: [FB] FB^3 Rosetta Stone Library

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

From: Alain Pastor <apastor@...>
Date: Sat, 20 Oct 2001 15:14:02 +0200
Ken Shmidheiser wrote:
> 
> 
> Periodically I hope to update the library as new cross-platform
> functions are translated, or as better ones are developed.

According to Osamu explanations I would add the following:


'~RZAP$

LOCAL FN RZAP$( rZapStr AS STR255 )

DO
SELECT rZapStr[rZapStr[0]]
CASE 32,13,9,10,11,0 : rZapStr[0]--
CASE ELSE            : EXIT DO
END SELECT
UNTIL _nil

END FN = rZapStr

DIM myStr AS STR255

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

PRINT:Print "FN RZAP$ removed the trailing chars in this string:"
PRINT FN RZAP$( myStr )

'~LZAP$

LOCAL FN LZAP$( lZapStr AS STR255 )
DIM i AS INTEGER

i = 0
WHILE i < lZapStr[0]
SELECT lZapStr[i + 1]
CASE 32,13,9,10,11,0 : i++
CASE ELSE            : EXIT WHILE
END SELECT
WEND
lZapStr[i] = lZapStr[0] - i

END FN = PSTR$(@lZapStr[i])


DIM myStr AS STR255

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

PRINT:Print "FN LZAP$ removed the leading chars in this string:"
print """";myStr;""""
PRINT """";FN LZAP$( myStr );""""

'~ZAP$

LOCAL FN ZAP$( zapStr AS STR255 )
DIM i AS INTEGER

DO
SELECT zapStr[zapStr[0]]
CASE 32,13,9,10,11,0 : zapStr[0]--
CASE ELSE            : EXIT DO
END SELECT
UNTIL _nil

i = 0
WHILE i < zapStr[0]
SELECT zapStr[i + 1]
CASE 32,13,9,10,11,0 : i++
CASE ELSE            : EXIT WHILE
END SELECT
WEND

zapStr[i] = zapStr[0] - i

END FN = PSTR$(@zapStr[i])


DIM myStr AS STR255

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

PRINT:Print "FN ZAP$ removed the leading and trailing chars in this string:"
print """";myStr;""""
PRINT """";FN ZAP$( myStr );""""
-- 

Cheers

Alain

-----------------------------------------------------
FB^3 in Europe:  http://euro.futurebasic.com/
FB II Pouch:     http://www.pixmix.com/FB/outils.html
-----------------------------------------------------