The Asc function converts the first letter in a string to ANSI code,
and returns the result. Its parameter is string which describes
the string as an expression and there cannot be a empty string. The
Asc function might seem obscure at first - who wants to know the ASCII
code for characters? But this actually can become quite important
in data processing. Sure, if you're wondering if a character is the
letter A you can just do a straight comparison if LetterInput = "A"
then ...but there are special characters that can end up in strings
that are much harder to test for. The two most notorious are the carriage
return and the line feed. These are ASCII strings 10 and 13. They
can cause all sorts of formatting problems and cause your parsing
to go haywire. To use the Asc function, you feed in a character
and it returns the numeric ASCII ID of that character.
CodeNum = ASC (LetterInput)
if CodeNum = 10 or CodeNum = 13 then response.write "Invalid
Entry"
The Syntax of Asc Function is :-
Example#1 :-
Code :-
document.write(Asc("A") & "<br />")
document.write(Asc("F"))
Output :-
657 |
Example#2 :-
Code :-
document.write(Asc("a") & "<br />")
document.write(Asc("f"))
Output :-
97102 |
Example#3 :-
Code :-
document.write(Asc("W") & "<br />")document.write(Asc("virtualsplat.com"))
Output :-
8787 |
Example#4 :-
Code :-
document.write(Asc("2") & "<br />")
document.write(Asc("#"))
Output :-
5035 |
|