[Gambas-user] Trim$

Tobias Boege taboege at gmail.com
Sun Jan 24 22:44:06 CET 2021


On Mon, 25 Jan 2021, Shane wrote:
> Morning all
> 
> I was in the need to remove spaces from a string today so I looked at the
> docs for the answer
> 
> and found Trim$
> 
> _Strip white spaces from the left and from the right of the string
> __Expr__._
> 
> __
> 
> _A white space is any character whose ASCII code is strictly lower than 32_.
> 
> yep thats what I need but it did not work so I looked up ascii character for
> Space and found it was 32
> 
> so yes this would not work! My question, is this by design? or should ascii
> 32 be included?
> 

It should be and on my version of Gambas it is:

  $ gbx3 --version
  3.14.90
  $ gbx3 -e '"»" & Trim$(" \e  asd \t\n  ") & "«"'
  »asd«

It seems like Benoît edited the wiki just now to say what should be correct:

  A white space is any character whose ASCII code is lower
  or equal than 32.

Best,
Tobias

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list