@@ -245,8 +245,24 @@ pub trait Char {
245
245
/// # Panics
246
246
///
247
247
/// Panics if given a radix > 36.
248
+ #[ deprecated = "use is_digit" ]
248
249
fn is_digit_radix ( & self , radix : uint ) -> bool ;
249
250
251
+ /// Checks if a `char` parses as a numeric digit in the given radix.
252
+ ///
253
+ /// Compared to `is_digit()`, this function only recognizes the characters
254
+ /// `0-9`, `a-z` and `A-Z`.
255
+ ///
256
+ /// # Return value
257
+ ///
258
+ /// Returns `true` if `c` is a valid digit under `radix`, and `false`
259
+ /// otherwise.
260
+ ///
261
+ /// # Failure
262
+ ///
263
+ /// Fails if given a radix > 36.
264
+ fn is_digit ( & self , radix : uint ) -> bool ;
265
+
250
266
/// Converts a character to the corresponding digit.
251
267
///
252
268
/// # Return value
@@ -319,8 +335,11 @@ pub trait Char {
319
335
320
336
#[ experimental = "trait is experimental" ]
321
337
impl Char for char {
338
+ #[ deprecated = "use is_digit" ]
322
339
fn is_digit_radix ( & self , radix : uint ) -> bool { is_digit_radix ( * self , radix) }
323
340
341
+ fn is_digit ( & self , radix : uint ) -> bool { is_digit_radix ( * self , radix) }
342
+
324
343
fn to_digit ( & self , radix : uint ) -> Option < uint > { to_digit ( * self , radix) }
325
344
326
345
fn from_digit ( num : uint , radix : uint ) -> Option < char > { from_digit ( num, radix) }
0 commit comments