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

Side by Side Diff: pkg/intl/lib/number_format.dart

Issue 12262030: Stop using deprecated charCodeAt in Intl (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | « pkg/intl/lib/bidi_utils.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) 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 library number_format; 5 library number_format;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import "intl.dart"; 9 import "intl.dart";
10 import "number_symbols.dart"; 10 import "number_symbols.dart";
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 */ 251 */
252 void _group(int totalLength, int position) { 252 void _group(int totalLength, int position) {
253 var distanceFromEnd = totalLength - position; 253 var distanceFromEnd = totalLength - position;
254 if (distanceFromEnd <= 1 || _groupingSize <= 0) return; 254 if (distanceFromEnd <= 1 || _groupingSize <= 0) return;
255 if (distanceFromEnd % _groupingSize == 1) { 255 if (distanceFromEnd % _groupingSize == 1) {
256 _add(symbols.GROUP_SEP); 256 _add(symbols.GROUP_SEP);
257 } 257 }
258 } 258 }
259 259
260 /** Returns the code point for the character '0'. */ 260 /** Returns the code point for the character '0'. */
261 int get _zero => '0'.charCodes[0]; 261 int get _zero => '0'.codeUnits.first;
262 262
263 /** Returns the code point for the locale's zero digit. */ 263 /** Returns the code point for the locale's zero digit. */
264 int get _localeZero => symbols.ZERO_DIGIT.charCodeAt(0); 264 // Note that there is a slight risk of a locale's zero digit not fitting
265 // into a single code unit, but it seems very unlikely, and if it did,
266 // there's a pretty good chance that our assumptions about being able to do
267 // arithmetic on it would also be invalid.
268 int get _localeZero => symbols.ZERO_DIGIT.codeUnits.first;
265 269
266 /** 270 /**
267 * Returns the prefix for [x] based on whether it's positive or negative. 271 * Returns the prefix for [x] based on whether it's positive or negative.
268 * In en_US this would be '' and '-' respectively. 272 * In en_US this would be '' and '-' respectively.
269 */ 273 */
270 String _signPrefix(num x) { 274 String _signPrefix(num x) {
271 return x.isNegative ? _negativePrefix : _positivePrefix; 275 return x.isNegative ? _negativePrefix : _positivePrefix;
272 } 276 }
273 277
274 /** 278 /**
275 * Returns the suffix for [x] based on wether it's positive or negative. 279 * Returns the suffix for [x] based on wether it's positive or negative.
276 * In en_US there are no suffixes for positive or negative. 280 * In en_US there are no suffixes for positive or negative.
277 */ 281 */
278 String _signSuffix(num x) { 282 String _signSuffix(num x) {
279 return x.isNegative ? _negativeSuffix : _positiveSuffix; 283 return x.isNegative ? _negativeSuffix : _positiveSuffix;
280 } 284 }
281 } 285 }
OLDNEW
« no previous file with comments | « pkg/intl/lib/bidi_utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698