perl6/doc/lib/X/Str/Numeric

doc src
(title) class X::Str::Numeric
    class X::Str::Numeric is Exception { }

 
Error thrown (or wrapped in a Failure ) when a a conversion from string to a number fails. For example
    say +"42 answers"

 
dies with
    Cannot convert string to number: trailing characters after number in '42⏏ answers' (indicated by ⏏)

 

Methods

(head2) source
    method source() returns Str:D

 
Returns the string that was attempted to convert to a number
(head2) pos
    method pos() returns Int:D

 
Gives the position into the string where the parsing failed.
(head2) reason
    method reason() returns Int:D

 
Verbal description of the reason why the conversion failed.

Perl 6 Tricks and Treats newsletter

Register to the free newsletter now, and get updates and news.
Email:
Name: