diff options
| author | Brian Anderson <banderson@mozilla.com> | 2014-10-08 17:24:15 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2014-11-21 13:17:09 -0800 |
| commit | acb5fefd6d9933b345873355c2c0100184c74727 (patch) | |
| tree | 489e1d4d66c78880d1097926b9343f5e5743cb35 /src/libcore | |
| parent | c2aff692fa88235d356725f98184a5ea5b52eb88 (diff) | |
core: Rename Char::is_digit_radix to is_digit
This fits the naming of `to_digit` and `from_digit`. Leave the old name deprecated.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/char.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 1c5de09dd0c..428a5879b8b 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -245,8 +245,24 @@ pub trait Char { /// # Panics /// /// Panics if given a radix > 36. + #[deprecated = "use is_digit"] fn is_digit_radix(&self, radix: uint) -> bool; + /// Checks if a `char` parses as a numeric digit in the given radix. + /// + /// Compared to `is_digit()`, this function only recognizes the characters + /// `0-9`, `a-z` and `A-Z`. + /// + /// # Return value + /// + /// Returns `true` if `c` is a valid digit under `radix`, and `false` + /// otherwise. + /// + /// # Failure + /// + /// Fails if given a radix > 36. + fn is_digit(&self, radix: uint) -> bool; + /// Converts a character to the corresponding digit. /// /// # Return value @@ -319,8 +335,11 @@ pub trait Char { #[experimental = "trait is experimental"] impl Char for char { + #[deprecated = "use is_digit"] fn is_digit_radix(&self, radix: uint) -> bool { is_digit_radix(*self, radix) } + fn is_digit(&self, radix: uint) -> bool { is_digit_radix(*self, radix) } + fn to_digit(&self, radix: uint) -> Option<uint> { to_digit(*self, radix) } fn from_digit(num: uint, radix: uint) -> Option<char> { from_digit(num, radix) } |
