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

Unified Diff: packages/path/lib/src/utils.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/path/lib/src/style/windows.dart ('k') | packages/path/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/path/lib/src/utils.dart
diff --git a/packages/path/lib/src/utils.dart b/packages/path/lib/src/utils.dart
index e32074950e7a197bf2dca44f9e3ad47bad2a3eba..3d71e560e7627ab7d8c07444be000360482027f8 100644
--- a/packages/path/lib/src/utils.dart
+++ b/packages/path/lib/src/utils.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library path.utils;
-
import 'characters.dart' as chars;
/// Returns whether [char] is the code for an ASCII letter (uppercase or
@@ -14,3 +12,13 @@ bool isAlphabetic(int char) =>
/// Returns whether [char] is the code for an ASCII digit.
bool isNumeric(int char) => char >= chars.ZERO && char <= chars.NINE;
+
+/// Returns whether [path] has a URL-formatted Windows drive letter beginning at
+/// [index].
+bool isDriveLetter(String path, int index) {
+ if (path.length < index + 2) return false;
+ if (!isAlphabetic(path.codeUnitAt(index))) return false;
+ if (path.codeUnitAt(index + 1) != chars.COLON) return false;
+ if (path.length == index + 2) return true;
+ return path.codeUnitAt(index + 2) == chars.SLASH;
+}
« no previous file with comments | « packages/path/lib/src/style/windows.dart ('k') | packages/path/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698