Index: pkg/string_scanner/lib/src/string_scanner.dart |
diff --git a/pkg/string_scanner/lib/src/string_scanner.dart b/pkg/string_scanner/lib/src/string_scanner.dart |
index 44d5d2d87efb2d7b037aebb5ef7ffb66252ce96f..bc5e1f58d4c872ad46c3de1ef021d1badb41e90a 100644 |
--- a/pkg/string_scanner/lib/src/string_scanner.dart |
+++ b/pkg/string_scanner/lib/src/string_scanner.dart |
@@ -131,6 +131,15 @@ class StringScanner { |
return _lastMatch != null; |
} |
+ /// Returns the substring of [string] between [start] and [end]. |
+ /// |
+ /// Unlike [String.substring], [end] defaults to [position] rather than the |
+ /// end of the string. |
+ String substring(int start, [int end]) { |
+ if (end == null) end = position; |
+ return string.substring(start, end); |
+ } |
+ |
/// Throws a [FormatException] with [message] as well as a detailed |
/// description of the location of the error in the string. |
/// |