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

Christof Thalhofer chrisml at deganius.de
Tue Nov 10 10:33:43 CET 2020


Am 10.11.20 um 10:08 schrieb Martin:

> Hi, i made some tests also.
> 
> the results was:
> 
> ' The faster
> 
> Public Function BrianTrim(sRaw As String) As String

This should be called TobiTrim, as this idea came from Tobi:

>   Dim sOut As String
>   sOut = Trim$(RegExp.Replace(sRaw, " {2,}+", " "))
>   Return sOut
> End

Very funny, on my computer Regexp is significantly slower, maybe it is
also a matter of computational power or even cpu cores?

> Nice exercise.

Yes, funny!

Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201110/0b4f099a/attachment-0001.sig>


More information about the User mailing list