Returns the ASCII code for the first character in a string.
iCode=Asc (sString)
Variable | Description |
---|---|
iCode | The returned ASCII code. INTEGER. |
sString | The string to process. STRING. |
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.
[ ] 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)