[Gambas-user] Trim$

Shane buster6seven at gmail.com
Sun Jan 24 22:59:06 CET 2021


Here

Dim tmp As String

   Print GridView1.RowAt(Mouse.y)
   Print "String to Convert " & GridView1[GridView1.RowAt(Mouse.Y), 2].Text
   CertNum = Trim(GridView1[GridView1.RowAt(Mouse.Y), 2].Text)
   Print "Trimed String " & CertNum
   Print "Ascii " & Asc(CertNum, 3)
   Tmp = Replace(CertNum, Chr(32), "")
   Print "Replaced String " & Tmp

OUTPUT

String to Convert P1 0040 3967 4
Trimed String P1 0040 3967 4
Ascii 32
Replaced String P1004039674


On 25/1/21 8:43 am, Jussi Lahtinen wrote:
> Please show the failed code.
>
> Jussi
>
> On Sun, Jan 24, 2021 at 11:35 PM Shane <buster6seven at gmail.com 
> <mailto:buster6seven at gmail.com>> 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?
>
>
>     Cheers Shane
>
>
>
>     ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210125/2323ff81/attachment.htm>


More information about the User mailing list