Something I wasn't able to find: how to declare a char in the IDE that is not CHR(xx)
"A" is really string, not a single char, and I need a map as the following:
Dim pcChar As Char = Asc("A")
Dim psString As String = "A"
If pcChar = psString Then
Log("Char = String")
Else
Log("Char <> String")
End If
If pcChar = "A" Then
Log("Char = 'A'")
Else
Log("Char <> 'A'")
End If
If pcChar = 65 Then
Log("Char = 65")
Else
Log("Char <> 65")
End If
thank you for your answer
to add a little more context
B4X:
countrymap.Get(m_VIN.CharAt(0))
won't work with my first declaration, while it works with yours
i was wondering if there's a more compact way to specify a single char instead of chr(asc(x))
What you don't say is why you want to use a Char as a key for the map.
EDIT: sorry you did.
If you are getting the keys from somewhere else to query the map, it may be easier to use strings and convert the key to a string on accessing the map, something like:
If you are getting the keys from somewhere else to query the map, it may be easier to use strings and convert the key to a string on accessing the map, something like:
thanks for your clever way to convert a char to a string on the fly: i missed it
but i still prefer to avoid conversions and work only with the minimal data required