1. Re: trim function
Dear Lucius,
I hate doing this to you again, but your trim function chokes on empty
strings and on strings consisting entirely of white space. Sorry. jiri
function trim(sequence s)
-- trim 'white space' from both ends of string s
integer c,i,j,len
len=length(s)
-- left trim:
i=1
while i<=len do
c=s[i]
if c=32 or c=9 then i+=1
else exit
end if
end while
-- right trim:
j=len
while j>=i do
c=s[j]
if c=32 or c=10 or c= 13 or c=9 then j-=1
else exit
end if
end while
return s[i..j]
end function -- trim