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

Side by Side Diff: third_party/pkg/route_hierarchical/lib/pattern.dart

Issue 460613002: Add optional start index to Pattern.allMatches. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add extra test. Created 6 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
« sdk/lib/core/pattern.dart ('K') | « tests/language/reg_exp_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Pattern utilities for use with server.Router. 6 * Pattern utilities for use with server.Router.
7 * 7 *
8 * Example: 8 * Example:
9 * 9 *
10 * var router = new Router(server); 10 * var router = new Router(server);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 /// return the tail 72 /// return the tail
73 Match prefixMatch(Pattern pattern, String str) { 73 Match prefixMatch(Pattern pattern, String str) {
74 Iterable<Match> matches = pattern.allMatches(str); 74 Iterable<Match> matches = pattern.allMatches(str);
75 if (!matches.isEmpty && matches.first.start == 0) { 75 if (!matches.isEmpty && matches.first.start == 0) {
76 return matches.first; 76 return matches.first;
77 } 77 }
78 return null; 78 return null;
79 } 79 }
80 80
81 bool _hasMatch(Iterable<Match> matches) => matches.iterator.moveNext(); 81 bool _hasMatch(Iterable<Match> matches) => matches.iterator.moveNext();
OLDNEW
« sdk/lib/core/pattern.dart ('K') | « tests/language/reg_exp_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698