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

Side by Side Diff: sdk/lib/core/int.dart

Issue 85633003: Add num.parse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove inserted letter in comment. Created 7 years 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
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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An arbitrarily large integer. 8 * An arbitrarily large integer.
9 * 9 *
10 * **Note:** When compiling to JavaScript, integers are 10 * **Note:** When compiling to JavaScript, integers are
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 */ 239 */
240 String toRadixString(int radix); 240 String toRadixString(int radix);
241 241
242 /** 242 /**
243 * Parse [source] as an integer literal and return its value. 243 * Parse [source] as an integer literal and return its value.
244 * 244 *
245 * The [radix] must be in the range 2..36. The digits used are 245 * The [radix] must be in the range 2..36. The digits used are
246 * first the decimal digits 0..9, and then the letters 'a'..'z'. 246 * first the decimal digits 0..9, and then the letters 'a'..'z'.
247 * Accepts capital letters as well. 247 * Accepts capital letters as well.
248 * 248 *
249 * If no [radix] is given then it defaults to 16 if the string starts 249 * If no [radix] is given then it defaults to 16 if the string starts
floitsch 2013/11/25 12:50:53 .. it defaults to 10, unless the string starts wit
Lasse Reichstein Nielsen 2013/11/25 13:05:16 Sounds much better. Done!
250 * with "0x", "-0x" or "+0x" and 10 otherwise. 250 * with "0x", "-0x" or "+0x" (and the "0x" is then ignored) and 10 otherwise.
251 * 251 *
252 * The [source] must be a non-empty sequence of base-[radix] digits, 252 * The [source] must be a non-empty sequence of base-[radix] digits,
253 * optionally prefixed with a minus or plus sign ('-' or '+'). 253 * optionally prefixed with a minus or plus sign ('-' or '+').
254 * 254 *
255 * It must always be the case for an int [:n:] and radix [:r:] that 255 * It must always be the case for an int [:n:] and radix [:r:] that
256 * [:n == parseRadix(n.toRadixString(r), r):]. 256 * [:n == parseRadix(n.toRadixString(r), r):].
257 * 257 *
258 * If the [source] is not a valid integer literal, optionally prefixed by a 258 * If the [source] is not a valid integer literal, optionally prefixed by a
259 * sign, the [onError] is called with the [source] as argument, and its return 259 * sign, the [onError] is called with the [source] as argument, and its return
260 * value is used instead. If no [onError] is provided, a [FormatException] 260 * value is used instead. If no [onError] is provided, a [FormatException]
261 * is thrown. 261 * is thrown.
262 * 262 *
263 * The [onError] function is only invoked if [source] is a [String]. It is 263 * The [onError] function is only invoked if [source] is a [String]. It is
264 * not invoked if the [source] is, for example, `null`. 264 * not invoked if the [source] is, for example, `null`.
265 */ 265 */
266 external static int parse(String source, 266 external static int parse(String source,
267 { int radix, 267 { int radix,
268 int onError(String source) }); 268 int onError(String source) });
269 } 269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698