VBScript Asc
Function
The Asc function converts the first character of a string to its corresponding ANSI code and returns the result.
Syntax
Parameter | Description |
---|---|
string | Required. String expression. Cannot be an empty string! |
Example
Example 1
The above example output:
Example 2
Asc returns the ANSI code of the first character in the string:
The above example output:
Example 3
How to return the ANSI code of all characters in a string:
<script type="text/vbscript">
txt="tutorialpro.org"
for i=1 to len(txt)
document.write(Asc(mid(txt,i,1)) & "<br />")
next
</script>
The above example output: