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

Side by Side Diff: utils/pub/utils.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 9 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
« no previous file with comments | « utils/pub/log.dart ('k') | utils/template/codegen.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /// Generic utility functions. Stuff that should possibly be in core. 5 /// Generic utility functions. Stuff that should possibly be in core.
6 library utils; 6 library utils;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:crypto'; 9 import 'dart:crypto';
10 import 'dart:isolate'; 10 import 'dart:isolate';
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool endsWithPattern(String str, Pattern matcher) { 134 bool endsWithPattern(String str, Pattern matcher) {
135 for (var match in matcher.allMatches(str)) { 135 for (var match in matcher.allMatches(str)) {
136 if (match.end == str.length) return true; 136 if (match.end == str.length) return true;
137 } 137 }
138 return false; 138 return false;
139 } 139 }
140 140
141 /// Returns the hex-encoded sha1 hash of [source]. 141 /// Returns the hex-encoded sha1 hash of [source].
142 String sha1(String source) { 142 String sha1(String source) {
143 var sha = new SHA1(); 143 var sha = new SHA1();
144 sha.add(source.charCodes); 144 sha.add(source.codeUnits);
145 return CryptoUtils.bytesToHex(sha.close()); 145 return CryptoUtils.bytesToHex(sha.close());
146 } 146 }
147 147
148 /// Invokes the given callback asynchronously. Returns a [Future] that completes 148 /// Invokes the given callback asynchronously. Returns a [Future] that completes
149 /// to the result of [callback]. 149 /// to the result of [callback].
150 /// 150 ///
151 /// This is also used to wrap synchronous code that may thrown an exception to 151 /// This is also used to wrap synchronous code that may thrown an exception to
152 /// ensure that methods that have both sync and async code only report errors 152 /// ensure that methods that have both sync and async code only report errors
153 /// asynchronously. 153 /// asynchronously.
154 Future defer(callback()) { 154 Future defer(callback()) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 /// Add all key/value pairs from [source] to [destination], overwriting any 336 /// Add all key/value pairs from [source] to [destination], overwriting any
337 /// pre-existing values. 337 /// pre-existing values.
338 void mapAddAll(Map destination, Map source) => 338 void mapAddAll(Map destination, Map source) =>
339 source.forEach((key, value) => destination[key] = value); 339 source.forEach((key, value) => destination[key] = value);
340 340
341 /// Decodes a URL-encoded string. Unlike [decodeUriComponent], this includes 341 /// Decodes a URL-encoded string. Unlike [decodeUriComponent], this includes
342 /// replacing `+` with ` `. 342 /// replacing `+` with ` `.
343 String urlDecode(String encoded) => 343 String urlDecode(String encoded) =>
344 decodeUriComponent(encoded.replaceAll("+", " ")); 344 decodeUriComponent(encoded.replaceAll("+", " "));
OLDNEW
« no previous file with comments | « utils/pub/log.dart ('k') | utils/template/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698