|
|
|
Triming spaces from string
Added on 6/5/2002
|
Use this code to trim the spaces present in a string either at the end of the string or at the beginning of the string
-- Use this code to trim the spaces present in a string either at the end of the string
-- or at the beginning of the string
on Ltrim Str
--trims the spaces from the left of the string
repeat while chars(Str,1,1)=" "
set Str=chars(Str,2,length(Str))
end repeat
return Str
end
on Rtrim Str
--trims the spaces from the right of the string
set i=length(Str)
repeat While chars(Str,i,i)=" "
set Str=chars(Str,1,i-1)
set i=length(Str)
end repeat
return Str
end
on TrimBoth Str
Set Str=Ltrim(Str)
set Str=Rtrim(Str)
return Str
end
|
|