I'm trying to write a function that checks to see if a character is somewhere within the ASCII table.
B4X:
Sub IsCharacter (Character As Char) As Boolean
If Conv.CharsToBytes(Character) > 0x20 AND Conv.CharsToBytes(Character) < 0x7E Then
Return True
Else
Return False
End If
End Sub
Can you help me understand what is the compiler barking at?
B4X:
Parsing code. 0.01
Compiling code. Error
Error compiling program.
Error description: Cannot cast type: {Type=Char,Rank=0} to: {Type=Char,Rank=1}
Occurred on line: 410
If Conv.CharsToBytes(Character) > 0x20 AND Conv.CharsToBytes(Character) < 0x7E Then
Word: character
The help is in included each library xml file. The online help is extracted from these xml files but is not always up to date. You can view it from your local library files, which should be the most up to date, using
Almost, you know how we have the IsNumber(Text As String) in the library? Well I was trying to write a Sub that would search to see if a character passed to it lies withing 0x20 and 0x7E on the ASCII table; which Stevel05's solution addressed it.