curs=Starter.SQL1.ExecQuery("SELECT * FROM bnotes")
If curs.RowCount=0 Then Return
For i=0 To curs.rowcount-1
curs.Position=i
Dim nid As Int=curs.GetInt("id")
Dim co As String=curs.GetString("collection")
Do While co.CharAt(0)=" "
co=co.SubString(1)
Loop
Starter.SQL1.execquery("UPDATE bnotes SET collection='" & co & "' WHERE id=" & nid)
Next
Agraham, the code doesn't want to give me the right anwser !!!
Star-Dust, each of your proposals doesn't work too !!!
"Code smells" are common patterns that can indicate that there is a problem in the code. A problem doesn't mean that the code doesn't work, it might be that it will be difficult to maintain it or that there are more elegant ways to implement the same thing. Remember that not everything is clear...
Many things have changed in B4X and also in the underlying platforms. I will try to list here all kinds of (old) features that have better alternatives. B4X is backward compatible so these features still work. The recommendations are more relevant for new projects or when implementing new...
www.b4x.com
Given the weird results you're getting, I'd try changing to a ResultSet and also to just use co.Trim, like @Star-Dust proposed. No need to be overly complicated about it. (Unless you really want to save trailing spaces in your string, of course.)
thanks to all!
when I translate the first char with Asc(co.CharAt(0)), i can read 32 which is the asc code of the space character. But with all your proposals, i'm stuck !
I continue to look for, to understand what or where is the...bug !
Damn ! even if I have 2 eyes, the brain was missing !
pfffff ! Yes, now it works !
How stupid I'm !
Thanks for looking for me ! As we say, that's better having many heads than one !