Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: pkg/string_scanner/lib/src/string_scanner.dart

Issue 689513002: Rewrite the pkg/yaml parser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/string_scanner/CHANGELOG.md ('k') | pkg/string_scanner/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
///
« no previous file with comments | « pkg/string_scanner/CHANGELOG.md ('k') | pkg/string_scanner/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698