routine unival
1 | class Int |
1.1 | (Int) routine unival |
2 | class Str |
2.1 | (Str) method unival |
Documentation for routine unival
assembled from the following types:
class Int
From Int
(Int) routine unival
Defined as:
multi sub unival(Int --> Numeric)multi method unival(Int: --> Numeric)
Returns the number represented by the Unicode codepoint with the given integer number, or NaN if it does not represent a number.
say ord("¾").unival; # OUTPUT: «0.75»say 190.unival; # OUTPUT: «0.75»say unival(65); # OUTPUT: «NaN»
class Str
From Str
(Str) method unival
multi method unival(Str --> Numeric)
Returns the numeric value that the first codepoint in the invocant represents, or NaN
if it's not numeric.
say '4'.unival; # OUTPUT: «4»say '¾'.unival; # OUTPUT: «0.75»say 'a'.unival; # OUTPUT: «NaN»