about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers3@gmail.com>2013-11-26 20:13:25 -0600
committerEric Biggers <ebiggers3@gmail.com>2013-11-26 20:13:25 -0600
commit7b96f13d7d046a5f625af73765515715a270757e (patch)
treedd392ff341f4dbaf14aae975d88b7050dde833b1
parent18687a92ae6b79eb221706db7b7390330b2f7a21 (diff)
downloadrust-7b96f13d7d046a5f625af73765515715a270757e.tar.gz
rust-7b96f13d7d046a5f625af73765515715a270757e.zip
std::ascii: Fix is_digit() and is_control()
is_digit() incorrectly returned false for '0'.
is_control() incorrectly returned true for ' ' (space).
-rw-r--r--src/libstd/ascii.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index 18b6a1ef52a..d62a03a5ad4 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -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
@@ -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)