Anyone using dot notation with strings?
Posted: Saturday 9th September 2023 5:42am
If I declare a String and ask for it's length in dot notation, the ascii version of the function is used - I find this unexpected! What's the logic behind this? Is the reason historical and related to backwards compatibility?
Dim TmpStr As String = "Benoît"
Print "String.Len() = " & String.Len(TmpStr) '6
Print "Len() = " & Len(TmpStr) '7
Print ".Len = " & TmpStr.Len '7 !!?? I would have expected the UTF8-version of the len function to be used here.
If I start typing .Left on gambas code editor, then a help window will pop up (http://gambaswiki.org/wiki/lang/left) stating the following: "This function only deals with ASCII strings. To manipulate UTF-8 strings, use the String.Left class." But if I start typing .Len, then no such warning is shown on the help screen (https://gambaswiki.org/wiki/comp/gb/_boxedstring/len).