VB-Scripting Asc v/s Chr Function – User friendly Tech help
Function Name:- Asc
n
nMeaning :- Used to get ANSI character code of “First” character of the string.
n
nANSI:- American National Standards Institute. Chart of ANSI
n
Syntax:- Asc(String)
n
- n
- No Arguments are given runtime error occurs
n
n
Function Name:- Chr
n
nMeaning :- Used to get character associated with ANSI character code(Reverse of Asc)
n
nANSI:- American National Standards Institute. Chart of ANSI
n
Syntax:- Chr(code)
n
- n
- Code :- ANSI number for a character
n
n
nExample:-
n
- n
- Msgbox Asc(“A”) ‘Returns ANSI value = 65
- Msgbox Chr(65) ‘Returns character value = A
- Msgbox Asc(“ufthelp”) ‘Returns ANSI value of ‘u’
- Msgbox Chr (117) ‘Returns ‘u’
- Msgbox Chr() ‘Throws Exception
- Msgbox Asc() ‘Throws Exception
n
n
n
n
n
n