Asc Function

Action

Returns the ASCII code for the first character in a string.

Syntax

iCode=Asc (sString)
Variable Description
iCode The returned ASCII code. INTEGER.
sString The string to process. STRING.

Notes

Asc returns an integer that corresponds to the ASCII code for the first character in sString. If sString is null, Silk Test Classic raises the exception E_NULL.

With Unicode content, Asc returns the Unicode character code of the first character in a string.

Example

[ ] STRING sInputLine // string of text as input
[ ] INTEGER iASCII // ASCII code of first char
[-] testcase asc_example ()
	[ ] sInputLine = "QAPartner" 
	[ ] iASCII = Asc (sInputLine) 
	[ ] // prints: ASCII for 1st letter of 'QAPartner' is 81
	[ ] Print ("1st letter of '{sInputLine}' is", iASCII)