chrGenerate a single-byte string from a number
&reftitle.description;
stringchrintcodepoint
Returns a one-character string containing the character specified
by interpreting codepoint as an unsigned integer.
This can be used to create a one-character string in a single-byte encoding such as ASCII, ISO-8859, or Windows 1252, by passing the position of a desired character in the encoding's mapping table. However, note that this function is not aware of any string encoding, and in particular cannot be passed a Unicode code point value to generate a string in a multibyte encoding like UTF-8 or UTF-16.
This function complements ord.
&reftitle.parameters;
codepoint
An integer between 0 and 255.
Values outside the valid range (0..255) will be bitwise and'ed with 255,
which is equivalent to the following algorithm:
&reftitle.returnvalues;
A single-character string containing the specified byte.
&reftitle.changelog;
&Version;&Description;7.4.0
The function no longer silently accepts unsupported codepoints,
and casts these to 0.
&reftitle.examples;
chr example
]]>
Overflow behavior
]]>
&example.outputs;
Building a UTF-8 string from individual bytes
]]>
&example.outputs;
🐘
&reftitle.seealso;
sprintf with a format string of %cordAn ASCII-tablemb_chr