Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

VBScript Chr Function

Returns the character associated with the specified ANSI character code.

Syntax: VBScript Chr Function

Chr(charcode)

Arguments: VBScript Chr Function

charcode

A number that identifies a character.

Remarks: VBScript Chr Function

Numbers from 0 to 31 are the same as standard, nonprintable ASCII codes. For example, Chr(10) returns a linefeed character.

The following example uses the Chr function to return the character associated with the specified character code:

Dim MyChar

MyChar = Chr(65)   ' Returns A.

MyChar = Chr(97)   ' Returns a.

MyChar = Chr(62)   ' Returns >.

MyChar = Chr(37)   ' Returns %.

Notes

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.

The behavior of the ChrB function depends on the byte ordering of the hardware platform, and the number of bytes used to represent Unicode characters in the system software. The function will produce different results on each supported operating system. Use with caution. The described behavior pertains to the Win32 version.

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.