Method

AscB


Warning

This item was deprecated in version 2019r2. Please use String.AscByte as a replacement.

Description

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

Usage

result=AscB(string)

OR

Introduced 5.0result=stringVariable.AscB

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.

Notes

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.

Sample code

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

Compatibility

All project types on all supported operating systems.