SoFunction
Updated on 2025-04-10

asp Chr function method to convert numbers to letters

Chr function
Returns the character corresponding to the specified ANSI character code.

Chr(charcode)

The charcode parameter is a number that can identify characters.

illustrate
Numbers from 0 to 31 represent standard non-printable ASCII code. For example, Chr(10) returns a newline character.

The following example uses the Chr function to return characters corresponding to the specified character code:

Dim MyChar
MyChar = Chr(65)   'Return to A.
MyChar = Chr(97)   'Return a.
MyChar = Chr(62)   'Return >.
MyChar = Chr(37)   'Return %. Note The ChrB function is used with byte data contained in a string. ChrB does not return a character of one or two bytes, but always returns a single byte character. ChrW is provided for 32-bit platforms that use Unicode characters. Its parameter is a Unicode (wide characters) character code, so it can avoid converting ANSI into Unicode characters.



Example: Output 26 letters For j = 0 to 25
     (chr(65+j))
Next
Note: The content comes from Microsoft Help Document