Skip to content

Commit

Permalink
std::ascii: Fix is_digit() and is_control()
Browse files Browse the repository at this point in the history
is_digit() incorrectly returned false for '0'.
is_control() incorrectly returned true for ' ' (space).
  • Loading branch information
ebiggers committed Nov 27, 2013
1 parent 18687a9 commit 7b96f13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libstd/ascii.rs
Expand Up @@ -67,7 +67,7 @@ impl Ascii {
/// Check if the character is a number (0-9)
#[inline]
pub fn is_digit(&self) -> bool {
self.chr >= 0x31 && self.chr <= 0x39
self.chr >= 0x30 && self.chr <= 0x39
}

/// Check if the character is a letter or number
Expand All @@ -85,7 +85,7 @@ impl Ascii {
/// Check if the character is a control character
#[inline]
pub fn is_control(&self) -> bool {
self.chr <= 0x20 || self.chr == 0x7F
self.chr < 0x20 || self.chr == 0x7F
}

/// Checks if the character is printable (except space)
Expand Down

0 comments on commit 7b96f13

Please sign in to comment.