implement str::is_whitespace using char::is_whitespace

This commit is contained in:
Lenny222 2012-01-02 21:14:20 +01:00 committed by Marijn Haverbeke
parent 439e28b751
commit e12b169247

View File

@ -116,14 +116,7 @@ Function: is_whitespace
Returns true if the string contains only whitespace
*/
fn is_whitespace(s: str) -> bool {
let i = 0u;
let len = char_len(s);
while i < len {
// FIXME: This is not how char_at works
if !char::is_whitespace(char_at(s, i)) { ret false; }
i += 1u;
}
ret true;
ret loop_chars(s, char::is_whitespace);
}
/*