chr

Prev Next

Function Names

chr

Description

This function returns the UNICODE character code of the character supplied.

Vectorization: This function supports vectorization in the 1st function parameter. Instead of providing a single value, you can provide a set or even a nested set which contain multiple values. The function will then process every value and its return value contains a corresponding set containing all results.

Call as: function

Restrictions

Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter

Parameter count

1

Parameters

No.TypeDescription
1
input
string
set
character code

Character code: 0 ... 1114111 (full UNICODE range). 0 returns an empty string. Vectorization: Provide a (nested) character set containîng the codes.

Return value

TypeDescription
numeral Decoded character

The string contains 1 character if a valid non-zero code is provided. For code 0, an empty string is returned.

Exceptions

Invalid character code (outside 0 - 1114111 range)

Examples

               echo( "'", chr( 0 ), "'" );      // Empty string
               echo( "'", chr( 65 ), "'" );     // A
               echo( "'", chr( 223 ), "'" );    // Sharp S
               echo( "'", chr( 8364 ), "'" );       // EURO sign
               echo( "'", chr( 119070 ), "'" ); // Violin clef
               echo( "'", chr({ 65, 223, 8364, 119070 } ), "'" );

Output

''
'A'
'ß'
'€'
'𝄞'
'{'A','ß','€','𝄞'}'
Try it yourself: Open LIB_Function_chr.b4p in B4P_Examples.zip. Decompress before use.

See also

code