1. faster right trim

This one is simpler & faster than previous one:

function rtrim(sequence s)
    -- discard trailing whitespace of sequence s

    for i = length(s) to 1 by -1 do
        if not find(s[i], {9,10,13,32}) then  return s[1..i] end if
    end for
    return {}
end function

jiri

----- Original Message -----
From: "Brian" <impee3 at EXCITE.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, December 14, 2000 5:32 PM
Subject: Whitespaces


> What's the easiest way to get rid of whitespaces at the end of a
string of
> text?
>
> Thanks,
> Brian
>

new topic     » topic index » view message » categorize

2. Re: faster right trim

Ole Jiri has got lots of goodies buried somewhere....
euman at bellsouth.net

----- Original Message -----
From: John <jwr6dmr at CS.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, December 14, 2000 9:53 AM
Subject: Re: faster right trim


> function rtrim(sequence s)    -- discard trailing whitespace of sequence s
>
>     for i = length(s) to 1 by -1 do
>         if not find(s[i], {9,10,13,32}) then  return s[1..i] end if    end
> for
>     return {}end function
>
> Thats good.. every once in a while you see some little gem and you just
gota
> paste it to your tools/file..
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: faster right trim

function rtrim(sequence s)    -- discard trailing whitespace of sequence s

    for i = length(s) to 1 by -1 do
        if not find(s[i], {9,10,13,32}) then  return s[1..i] end if    end
for
    return {}end function

Thats good.. every once in a while you see some little gem and you just gota
paste it to your tools/file..

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu