Skip to content

Commit cd16648

Browse files
committed
Document Int method on Match
1 parent 72dad49 commit cd16648

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/Match.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ Returns the matched text.
110110
"abc123def" ~~ /\d+/;
111111
say $/.Str; # OUTPUT: «123␤»
112112
113+
=head2 method Int
114+
115+
Defined as:
116+
117+
method Int(Match:D: --> Int:D)
118+
119+
Tries to convert stringified result of the matched text into Int.
120+
121+
say ('12345' ~~ /234/).Int; # OUTPUT: «234␤»
122+
# the next line produces a warning about using Nil (result of a no match) in numeric context
123+
say ('one-two' ~~ /234/).Int; # OUTPUT: «0␤» # because Nil.Int returns 0
124+
113125
=head2 method caps
114126
115127
Returns a list of pairs, with the index or submatch name as key and

0 commit comments

Comments
 (0)