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 
  • n

  • Msgbox Chr(65) ‘Returns character value = A 
  • n

  • Msgbox Asc(“ufthelp”) ‘Returns ANSI value of ‘u’ 
  • n

  • Msgbox Chr (117) ‘Returns ‘u’ 
  • n

  • Msgbox Chr() ‘Throws Exception 
  • n

  • Msgbox Asc() ‘Throws Exception
  • n

Was this article helpful?
YesNo

Similar Posts