Chr Function

Tips >>ASP Functions


WANTS TO MAKE SOFTWARE WITHOUT KNOWLEDGE OF ASP? CLICK HERE

The Chr function converts the specified ANSI character code to a character. Its parameter charcode which describes a number that identifies a character. The charcode argument is a number that identifies a character.


Note : - The numbers from 0 to 31 represents non printable ASCII codes, i.e. Chr(10) will return a linefeed character.

The Syntax of Chr function is :-

Chr(charcode)

These table explains you the usefull ANSI characters :-

Usefull ANSI characters
chr(13) Carriage return
chr(13)&chr(10) Combination carriage return and line feed
chr(12) Form feed
chr(10) Line feed
chr(9) Horizontal tab
chr(11) Vertical tab

Example#1 :-

Code :-
document.write(Chr(65) & "<br />")
document.write(Chr(97))
Output :-
A
a

Example#2 :-

Code :-
document.write(Chr(37) & "<br />")
document.write(Chr(45))
Output :-
%
-

Example#3 :-

Code :-
document.write(Chr(50) & "<br />")
document.write(Chr(35))
Output :-
2
#

Example#4 :-

Before: Code: After:
104 Chr("104") h
72 Chr("72") H
38 Chr("38") &

Example#5 :-

Code :-
WScript.echo Chr(65), Chr(66), Chr(67)
Output :-
"A B C".

Note :- The ChrB function is used with byte data contained in a string. Instead of returning a character, which may be one or two bytes, ChrB always returns a single byte. ChrW is provided for 32-bit platforms that use Unicode characters. Its argument is a Unicode (wide) character code, thereby avoiding the conversion from ANSI to Unicode.

 

 

 

E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641