left$ vs String.left behaviour

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

left$ vs String.left behaviour

PICCORO McKAY Lenz
i have a var named query1 = "`SHW325X`,"

when i do  String.Left(querycolsinserts, -1) the las char "," are not
removed, so i used  Left$(querycolsinserts, -1) and works..

now this due the "`" char inside?

so then how can i do when i dont know if the string are utf-8 or not? due
the behaviour depends of the utf-8 nature of the string!


Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: left$ vs String.left behaviour

Charlie
I'm not sure where 'querycolsinserts' comes in to this but the code below works fine: -

Public Sub Form_Open()
Dim query1 As String = "`SHW325X`,"
Dim siCount As Short

For siCount = Len(query1) DownTo 1
Print String.Left(query1, siCount)
Next

Print String.Left(query1, -1)
Print Left$(query1, -1)
Print Left(query1, -1)

End

The output is: -

`SHW325X`,
`SHW325X`
`SHW325X
`SHW325
`SHW32
`SHW3
`SHW
`SH
`S
`
`SHW325X`
`SHW325X`
`SHW325X`

Check out www.gambas.one

Reply | Threaded
Open this post in threaded view
|

Re: left$ vs String.left behaviour

PICCORO McKAY Lenz
2017-05-23 7:07 GMT-04:00 Charlie <[hidden email]>:

> I'm not sure where 'querycolsinserts' comes in to this but the code below
>
sorry was my fault, i mean "query1"


> works fine: -
>


> Print Left$(query1, -1)
> Print Left(query1, -1)
> The output is: -
> `SHW325X`
> `SHW325X`
> `SHW325X`
>
quite strange, in my system only the Left$ removed .. the other does not
work..

thanks for your example!


>
>
>
>
> -----
> Check out www.gambas.one
> --
> View this message in context: http://gambas.8142.n7.nabble.
> com/left-vs-String-left-behaviour-tp59070p59083.html
> Sent from the gambas-user mailing list archive at Nabble.com.
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user