OLD | NEW |
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 * Representation of Dart integers containing integer specific | 8 * Representation of Dart integers containing integer specific |
9 * operations and specialization of operations inherited from [num]. | 9 * operations and specialization of operations inherited from [num]. |
10 * | 10 * |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 /** | 64 /** |
65 * Returns a representation of this [int] value. | 65 * Returns a representation of this [int] value. |
66 * | 66 * |
67 * It should always be the case that if [:i:] is an [int] value, | 67 * It should always be the case that if [:i:] is an [int] value, |
68 * then [:i == int.parse(i.toString()):]. | 68 * then [:i == int.parse(i.toString()):]. |
69 */ | 69 */ |
70 String toString(); | 70 String toString(); |
71 | 71 |
72 /** | 72 /** |
| 73 * Converts [this] to a string representation in the given [radix]. |
| 74 * |
| 75 * In the string representation, lower-case letters are used for digits above |
| 76 * '9'. |
| 77 * |
| 78 * The [radix] argument must be an integer in the range 2 to 36. |
| 79 */ |
| 80 String toRadixString(int radix); |
| 81 |
| 82 /** |
73 * Parse [source] as an integer literal and return its value. | 83 * Parse [source] as an integer literal and return its value. |
74 * | 84 * |
75 * Accepts "0x" prefix for hexadecimal numbers, otherwise defaults | 85 * The [radix] must be in the range 2..36. The digits used are |
76 * to base-10. | 86 * first the decimal digits 0..9, and then the letters 'a'..'z'. |
| 87 * Accepts capital letters as well. |
77 * | 88 * |
78 * Throws a [FormatException] if [source] is not a valid integer literal. | 89 * If no [radix] is given then it defaults to 16 if the string starts |
| 90 * with "0x", "-0x" or "+0x" and 10 otherwise. |
| 91 * |
| 92 * The [source] must be a non-empty sequence of base-[radix] digits, |
| 93 * optionally prefixed with a minus or plus sign ('-' or '+'). |
| 94 * |
| 95 * It must always be the case for an int [:n:] and radix [:r:] that |
| 96 * [:n == parseRadix(n.toRadixString(r), r):]. |
| 97 * |
| 98 * If the [source] is not a valid integer literal, optionally prefixed by a |
| 99 * sign, the [onError] is called with the [source] as argument, and its return |
| 100 * value is used instead. If no [onError] is provided, a [FormatException] |
| 101 * is thrown. |
79 */ | 102 */ |
80 external static int parse(String source); | 103 external static int parse(String source, |
| 104 { int radix, |
| 105 int onError(String source) }); |
81 } | 106 } |
OLD | NEW |