ASC

Concept Link IconSee also

Return the ASCII code of the first character of a string.

WebVue support - Yes.

Syntax

IntVal = ASC(string[, iExtended]);

Return type: INTEGER.

Execution

Argument

Meaning

string A text string. Only the first character is used.
iExtended

For use with characters with the extended ANSI codes. Optional.

0: (default) returns a negative value when the code is greater than 127. To get the correct code 256 must be added.

1: returns a positive value when its code is greater than 127.

IntVal

The return value is in the range 0 to 255. If the string is null the function returns 0.

The return value is in the range from 0 to 255. If the string is null, the function returns 0.

Example

This example lists the ASCII codes of numbers up to 256.

Sub TestASC()

Dim i As Integer;

Dim c As Str;

Dim j As Integer;

 

For (i=0; i<256; i++)

c = Chr (i);

j = Asc (c, 1);

Print (i, " ", c, " ", j );

Next

End Sub