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

Bruce Steers bsteers4 at gmail.com
Mon Nov 9 19:40:20 CET 2020


Sorry Wend not Next lol

On Mon, 9 Nov 2020 at 18:35, Bruce Steers <bsteers4 at gmail.com> wrote:

> No my friend that will not work..
> This does...
> *While InStr(strinput,"  ")*
>
> *strinput = Replace(strinput, "  ", " ")*
>
> *Next*
> *strinput = Trim(strinput)*
>
> I already tried that :) it worked okay.
> I found various ways, the initial function i posted seemed to me to be the
> "gambas" way of doing it.
> Although if it was Benoíts code he'd probably use String.Mid$() and not a
> boxed string like i did :)
>
> I was just curious to know if i wasn't missing a function in gambas that
> already existed to do it :)
>
> Cheers :)
>
> On Mon, 9 Nov 2020 at 16:47, KKing <kicking177 at gmail.com> wrote:
>
>> how about
>> strInput = " This    has    many        spaces  "
>> strResult = Trim(Replace(strInput,"  "," "))
>>
>> > That will turn " This    has    many        spaces  "
>> > into "This has many spaces"
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201109/8a93eb4f/attachment-0001.htm>


More information about the User mailing list