[Gambas-user] trimming extra spaces from within a string.
Rolf-Werner Eilert
rwe-sse at osnanet.de
Tue Nov 10 11:56:23 CET 2020
Am 10.11.20 um 11:40 schrieb Martin:
> Hi Rolf, i think in the function that you propose don't remove the
> spaces at the beginning and at the end of the string.
Oh yes, that's true, forgot to include this. It would take a single
Trim(sOut) before the function returns.
>
> Anyway I think the good function is the Christof proposal because is
> very simple and everybody can manage that "technology". I say the good
> not the best that is Tobias proposal using regex in my computer at least
> :-).
Your race was a bit about speed. Using Replace() over and over might be
the drawback here, as it will certainly use a loop internally doing more
or less the same as my function does. The same applies to regex, and
even heavier.
But I agree, the other solutions are more elegant than mine :)
Regards
Rolf
More information about the User
mailing list