Sub CharNumberStringToChar(N As String) As Char
Dim CleanString As String = N.Trim.ToUpperCase
Dim CharNumber As Int = Asc("?") 'default for invalid input
If CleanString.Length > 2 Then
If CleanString.StartsWith("0X") Then 'note letter has been uppercased
CharNumber = Bit.ParseInt(CleanString.SubString(2), 16) 'assume is valid hex
else If CleanString.StartsWith("0D") Then
CharNumber = Bit.ParseInt(CleanString.SubString(2), 10) 'assume is valid decimal
else If CleanString.StartsWith("0B") Then
CharNumber = Bit.ParseInt(CleanString.SubString(2), 2) 'assume is valid binary
else if IsNumber(CleanString) Then
CharNumber = CleanString 'B4J will convert from decimal string
End If
else if CleanString.Length > 0 Then
If IsNumber(CleanString) Then
CharNumber = CleanString
End If
End If
Return Chr(CharNumber)
End Sub