[Gambas-user] trimming extra spaces from within a string.

Bruce Steers bsteers4 at gmail.com
Tue Nov 10 01:29:24 CET 2020


yep , been running some tests too.

the irony is the fastest way i see is the While , Wend loop method.
And that's how i first did it , then i thought i could do it better lol


On Mon, 9 Nov 2020 at 23:26, Christof Thalhofer <chrisml at deganius.de> wrote:

> Am 09.11.20 um 23:52 schrieb Fabien Bodard:
>
> > And .. sorry I'm on phone but
> >
> > Just walk on the string if not space add to new string ...if first space
> > too... jump to the next not space letter ...etc ?
> >
> > Is this not more faster than using a recursive call to replace ?
> >
> > The 3 ms gain from benoit can come from the fact he not use trim.
>
> That (3 ms) was just a joke because from run to run it differs between
> something about 2200 and 2400 ms.
>
> So I can see no difference at all between Benoît's solution and the
> while ... wend loop. Both are about three times faster than the Regexp
> and a couple of hundred times faster than Brians solution.
>
> If anyone wants to try it out here is the text I used to test it:
>
> https://paste.c-net.org/HoustonRoxanne
>
> It is some dadaistic poetry.
>
> Alles Gute
>
> Christof Thalhofer
>
> --
> Dies ist keine Signatur
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201110/2660521f/attachment.htm>


More information about the User mailing list