Skip to content

Commit d9293e9

Browse files
committed
Merge pull request #404 from rudis/master
Real: document how to convert string to number
2 parents 67b3028 + 24b25db commit d9293e9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/Real.pod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,16 @@ The final digit produced is always rounded.
7676
7777
say pi.base(10, 5); # 3.14159
7878
79+
To convert a string to a number use the C<:16($number)> notation where 16 is
80+
the base:
81+
82+
say :16("FF") # 255
83+
say :23("FF") # 360
84+
85+
Converting to a dynamic base requires the Rakudo internal function
86+
C<UNBASE()>:
87+
88+
my $base = 23;
89+
say UNBASE($base, "FF") # 360
90+
7991
=end pod

0 commit comments

Comments
 (0)