StringTrim
not ratedRemoves all spaces in the beginning and the end of string s.
The result is identical to StringTrimLeft( StringTrimRight( s ))
The result is identical to StringTrimLeft( StringTrimRight( s ))
function StringTrim takes string s returns string
local integer l = -1
local integer r = -1
local integer i = 0
local string c
if s == "" or s == null then
return s
endif
loop
set c = SubString( s, i, i + 1 )
exitwhen c == ""
if c != " " then
if l < 0 then
set l = i
endif
set r = i + 1
endif
set i = i + 1
endloop
if l < 0 then
return ""
endif
return SubString( s, l, r )
endfunctionNo comments.