[TF] mylib.tf : bug patch: strip_space()
Brought to you by:
kenkeys
|
From: tinyfugue at attbi.c. (Galvin) - 2003-04-27 02:51:44
|
Stirp_space() had a bug, mainly it didn't work correctly.
This code has now been fixed.
;==============================================================================
; strip_space()
;
; Strips all leading spaces from a string.
; USAGE:
; x := strip_space("string")
;
; x : Returned "string" with no leading spaces.
; "string" : Any string
;==============================================================================
/def strip_space = \
/let st_ 0 %;\
/test st_ := {1} %;\
/let st2_ 0 %;\
/let count_ $[strlen(st_)] %;\
/test st2_ := '' %;\
/WHILE ( (--count_ > 0) & (substr(st_, count_, 1) =~ ' ') ) \
/DONE %;\
/return substr(st_, 0, count_ + 1)
|