From Xojo Documentation


AscB(s as String) As Integer

Supported for all project types and targets.

Returns as an Integer, the value for the first byte of a String.



Introduced 5.0
Part Type Description
result Integer The value of the first character of string.
string String Any valid string expression.
StringVariable String Any variable of type String.


The AscB function returns the code for the first byte in the String passed. If you need to get the character code of the first character of the string rather than the first byte, use the Asc function.

AscB should be used instead of Asc when the string represents binary data or when your application will run on a one-byte character set (such as the US system) and you want case-sensitivity.


This example uses the AscB to get the value of the first byte of the string passed.

MsgBox Str(AscB("a")) //returns 97
MsgBox Str(AscB("A")) //returns 65

See Also

Asc, ChrB, InStrB, LeftB, LenB, MidB, RightB functions.