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

Unified Diff: sdk/lib/core/int.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « sdk/lib/core/future_impl.dart ('k') | sdk/lib/core/iterable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/int.dart
diff --git a/sdk/lib/core/int.dart b/sdk/lib/core/int.dart
index 261d2c4965cb9a823101d2111aacbd9126cdf340..2262574c7dd0ebdc69e2bfe98d33a69b30b4f153 100644
--- a/sdk/lib/core/int.dart
+++ b/sdk/lib/core/int.dart
@@ -70,12 +70,37 @@ abstract class int extends num {
String toString();
/**
+ * Converts [this] to a string representation in the given [radix].
+ *
+ * In the string representation, lower-case letters are used for digits above
+ * '9'.
+ *
+ * The [radix] argument must be an integer in the range 2 to 36.
+ */
+ String toRadixString(int radix);
+
+ /**
* Parse [source] as an integer literal and return its value.
*
- * Accepts "0x" prefix for hexadecimal numbers, otherwise defaults
- * to base-10.
+ * The [radix] must be in the range 2..36. The digits used are
+ * first the decimal digits 0..9, and then the letters 'a'..'z'.
+ * Accepts capital letters as well.
+ *
+ * If no [radix] is given then it defaults to 16 if the string starts
+ * with "0x", "-0x" or "+0x" and 10 otherwise.
+ *
+ * The [source] must be a non-empty sequence of base-[radix] digits,
+ * optionally prefixed with a minus or plus sign ('-' or '+').
+ *
+ * It must always be the case for an int [:n:] and radix [:r:] that
+ * [:n == parseRadix(n.toRadixString(r), r):].
*
- * Throws a [FormatException] if [source] is not a valid integer literal.
+ * If the [source] is not a valid integer literal, optionally prefixed by a
+ * sign, the [onError] is called with the [source] as argument, and its return
+ * value is used instead. If no [onError] is provided, a [FormatException]
+ * is thrown.
*/
- external static int parse(String source);
+ external static int parse(String source,
+ { int radix,
+ int onError(String source) });
}
« no previous file with comments | « sdk/lib/core/future_impl.dart ('k') | sdk/lib/core/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698