@@ -981,24 +981,6 @@ fn match_at<'a,'b>(haystack: &'a str, needle: &'b str, at: uint) -> bool {
981981Section: String properties
982982*/
983983
984- /**
985- * Returns true if the string contains only whitespace
986- *
987- * Whitespace characters are determined by `char::is_whitespace`
988- */
989- pub fn is_whitespace ( s : & str ) -> bool {
990- s. iter ( ) . all ( char:: is_whitespace)
991- }
992-
993- /**
994- * Returns true if the string contains only alphanumerics
995- *
996- * Alphanumeric characters are determined by `char::is_alphanumeric`
997- */
998- fn is_alphanumeric ( s : & str ) -> bool {
999- s. iter ( ) . all ( char:: is_alphanumeric)
1000- }
1001-
1002984/// Returns the number of characters that a string holds
1003985#[ inline( always) ]
1004986pub fn char_len ( s : & str ) -> uint { count_chars ( s, 0 u, s. len ( ) ) }
@@ -1749,14 +1731,14 @@ impl<'self> StrSlice<'self> for &'self str {
17491731 * Whitespace characters are determined by `char::is_whitespace`
17501732 */
17511733 #[inline]
1752- fn is_whitespace(&self) -> bool { is_whitespace(* self) }
1734+ fn is_whitespace(&self) -> bool { self.iter().all(char::is_whitespace ) }
17531735 /**
17541736 * Returns true if the string contains only alphanumerics
17551737 *
17561738 * Alphanumeric characters are determined by `char::is_alphanumeric`
17571739 */
17581740 #[inline]
1759- fn is_alphanumeric(&self) -> bool { is_alphanumeric(* self) }
1741+ fn is_alphanumeric(&self) -> bool { self.iter().all(char::is_alphanumeric ) }
17601742 /// Returns the size in bytes not counting the null terminator
17611743 #[inline(always)]
17621744 fn len(&self) -> uint {
@@ -2773,11 +2755,11 @@ mod tests {
27732755
27742756 #[ test]
27752757 fn test_is_whitespace( ) {
2776- assert!( is_whitespace ( "" ) ) ;
2777- assert!( is_whitespace ( " " ) ) ;
2778- assert!( is_whitespace ( "\u2009 " ) ) ; // Thin space
2779- assert!( is_whitespace ( " \n \t " ) ) ;
2780- assert!( !is_whitespace ( " _ " ) ) ;
2758+ assert!( "" . is_whitespace ( ) ) ;
2759+ assert!( " " . is_whitespace ( ) ) ;
2760+ assert!( "\u2009 " . is_whitespace ( ) ) ; // Thin space
2761+ assert!( " \n \t " . is_whitespace ( ) ) ;
2762+ assert!( !" _ " . is_whitespace ( ) ) ;
27812763 }
27822764
27832765 #[ test]
0 commit comments