Re: to Rob (isn't this a bit silly)
- Posted by Mike <michael at IGRIN.CO.NZ> Nov 29, 1998
- 435 views
To remove unwanted spaces at the end of a (simple) string I use the following routine.It would be easy to customize it to remove characters only from the left or tight side. -- " this is a " becomes "this is a" global function remove_end_spaces(sequence word) integer a,b a=0 b=length(word) if b then for i = 1 to b do if word[i]!=' ' then a=i exit end if end for if a then -- ok, at least one valid character detected for i = b to a by -1 do if word[i]!=' ' then b=i exit end if end for return word[a..b] end if end if return {} end function -----Original Message----- From: Alan Tu >This function is a function that I am using to trim off whitespace at the >end of a sequence. I am forced to put a statement in there that will >never, never, never, never, and yes, never, be executed to make the >interpreter happy. Why am I faking out the interpreter? 'cause otherwise >it wines. This defeats Euphoria's purpose of elegance.