YouTip LogoYouTip

Func Asc

# VBScript Asc Function * * Complete VBScript Reference Manual](#) * * * The Asc function converts the first letter in a string to its corresponding ANSI code and returns the result. ### Syntax Asc(string) | Parameter | Description | | :--- | :--- | | string | Required. A string expression. Cannot be an empty string! | ## Example ## Example 1 document.write(Asc("A") & "
") document.write(Asc("a") & "
") document.write(Asc("F") & "
") document.write(Asc("f") & "
") document.write(Asc("2") & "
") document.write(Asc("#") & "
") The output of the above example is: 65 97 70 102 50 35 [Try it Β»](#) ## Example 2 Asc returns the ANSI code of the first character in a string: document.write(Asc("o") & "
") document.write(Asc("")) The output of the above example is: 111 114 [Try it Β»](#) ## Example 3 How to return the ANSI codes of all characters in a string: txt="" for i=1 to len(txt) document.write(Asc(mid(txt,i,1)) & "
") next The output of the above example is: 114 117 110 111 111 98 46 99 111 109 [Try it Β»](#) * * Complete VBScript Reference Manual](#)
← Func CboolFunc Year β†’