From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

String.AscByte(s as String) As Integer

Supported for all project types and targets.

Returns the integer value for the first byte of a String.


This 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 String.Asc function instead.

You should use AscByte instead of Asc when the string represents binary data.

Sample Code

This code gets the value of the first byte of a String:

Var s1 As String = "a"
Var byte As Integer
byte = s1.AscByte // returns 97

Var s2 As String = "A"
byte = s2.AscByte // returns 65

See Also

String, String.IndexOfBytes, String.LeftBytes, String.Bytes, String.MiddleBytes, String.RightBytes