Name
chr — return a character with a given ASCII value
Synopsis
string chr(
ascii)
;
int
ascii
;
Description
Returns a string of length 1, in which the single character has the
ASCII value ascii. ascii should be in the range 0 to 255 inclusive,
otherwise the result is undefined.
Example 31. chr
Example
// Use chr() to turn a number into a string
string str = "";
int number = 42;
while(number > 0)
{
int digit = number % 10;
number /= 10;
str += chr(number + asc("0"));
}
print("The string is " + str);
See Also
This function complements the asc()
function.