routine chr
1 | class Int |
1.1 | (Int) routine chr |
2 | class Cool |
2.1 | (Cool) routine chr |
Documentation for routine chr
assembled from the following types:
class Int
From Int
(Int) routine chr
Defined as:
multi sub chr(Int --> Str)multi method chr(Int: --> Str)
Returns a one-character string, by interpreting the integer as a Unicode codepoint number and converting it to the corresponding character.
Example:
65.chr; # returns "A"196.chr; # returns "Ä"
class Cool
From Cool
(Cool) routine chr
Defined as:
sub chr(Int(Cool))method chr()
Coerces the invocant (or in sub form, its argument) to Int, interprets it as a Unicode code points, and returns a string made of that code point.
say '65'.chr; # OUTPUT: «A»
The inverse operation is ord.
Mnemonic: turns an integer into a character.