Equinox Online Help - Language Reference - A to Z

Home

Asc

Applies to
SyntaxAsc(StringExpression)
Action[Function] Returns the ASCII value of the first character in a string.
ScopeUsable anywhere.
Notes

This function returns a number (ASCII code) for the first character in the argument, StringExpression. If StringExpression does not contain any characters then -1 is returned.

CategoryConversions
See Also Card, HexNum, HexStr, Lowercase, Ord, Str, StrCase, StrDate, StrTime, Uppercase
Example

This example displays the number 65, on a dialog.

Alert Asc("A")

The ASCII value of the character "1" is 49. The next example prints "49 50 51 52" in the Print window.

number i
string s

s = "1234"

for i = 1 to Len(s)
Print Asc(s[i]),
next

This final example encrypts the string AMessage by converting A's to B's, B's to C's etc So "Hello" would become "Ifmmp".

for i = 1 to Len(AMessage)
AMessage[i] = Chr(Asc(AMessage[i]) + 1)
next