@@ -27,7 +27,6 @@ use option::{None, Option, Some};
2727use iterator:: Iterator ;
2828use ptr;
2929use str;
30- use u8;
3130use uint;
3231use vec;
3332use to_str:: ToStr ;
@@ -787,22 +786,6 @@ pub fn each_split_within<'a>(ss: &'a str,
787786 }
788787}
789788
790- /// Convert a string to lowercase. ASCII only
791- pub fn to_lower ( s : & str ) -> ~str {
792- do map ( s) |c| {
793- assert ! ( char :: is_ascii( c) ) ;
794- ( unsafe { libc:: tolower ( c as libc:: c_char ) } ) as char
795- }
796- }
797-
798- /// Convert a string to uppercase. ASCII only
799- pub fn to_upper ( s : & str ) -> ~str {
800- do map ( s) |c| {
801- assert ! ( char :: is_ascii( c) ) ;
802- ( unsafe { libc:: toupper ( c as libc:: c_char ) } ) as char
803- }
804- }
805-
806789/**
807790 * Replace all occurrences of one string with another
808791 *
@@ -1610,13 +1593,6 @@ pub fn ends_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
16101593Section: String properties
16111594*/
16121595
1613- /// Determines if a string contains only ASCII characters
1614- pub fn is_ascii ( s : & str ) -> bool {
1615- let mut i: uint = len ( s) ;
1616- while i > 0 u { i -= 1 u; if !u8:: is_ascii ( s[ i] ) { return false ; } }
1617- return true ;
1618- }
1619-
16201596/// Returns true if the string has length 0
16211597pub fn is_empty ( s : & str ) -> bool { len ( s) == 0 u }
16221598
@@ -2403,8 +2379,6 @@ pub trait StrSlice<'self> {
24032379 fn each_split_str<'a>(&self, sep: &'a str, it: &fn(&'self str) -> bool);
24042380 fn starts_with<'a>(&self, needle: &'a str) -> bool;
24052381 fn substr(&self, begin: uint, n: uint) -> &'self str;
2406- fn to_lower(&self) -> ~str;
2407- fn to_upper(&self) -> ~str;
24082382 fn escape_default(&self) -> ~str;
24092383 fn escape_unicode(&self) -> ~str;
24102384 fn trim(&self) -> &'self str;
@@ -2565,12 +2539,6 @@ impl<'self> StrSlice<'self> for &'self str {
25652539 fn substr(&self, begin: uint, n: uint) -> &'self str {
25662540 substr(*self, begin, n)
25672541 }
2568- /// Convert a string to lowercase
2569- #[inline]
2570- fn to_lower(&self) -> ~str { to_lower(*self) }
2571- /// Convert a string to uppercase
2572- #[inline]
2573- fn to_upper(&self) -> ~str { to_upper(*self) }
25742542 /// Escape each char in `s` with char::escape_default.
25752543 #[inline]
25762544 fn escape_default(&self) -> ~str { escape_default(*self) }
@@ -3084,27 +3052,6 @@ mod tests {
30843052 assert!(repeat(~" hi", 0) == ~" ");
30853053 }
30863054
3087- #[test]
3088- fn test_to_upper() {
3089- // libc::toupper, and hence str::to_upper
3090- // are culturally insensitive: they only work for ASCII
3091- // (see Issue #1347)
3092- let unicode = ~" "; //"\u65e5 \u672c " ; // uncomment once non-ASCII works
3093- let input = ~"abcDEF" + unicode + ~" xyz: . ; ";
3094- let expected = ~" ABCDEF " + unicode + ~" XYZ : . ; ";
3095- let actual = to_upper(input);
3096- assert!(expected == actual);
3097- }
3098-
3099- #[test]
3100- fn test_to_lower() {
3101- // libc::tolower, and hence str::to_lower
3102- // are culturally insensitive: they only work for ASCII
3103- // (see Issue #1347)
3104- assert!(~" " == to_lower(" "));
3105- assert!(~" ymca" == to_lower(" YMCA "));
3106- }
3107-
31083055 #[test]
31093056 fn test_unsafe_slice() {
31103057 assert!(" ab" == unsafe {raw::slice_bytes(" abc", 0, 2)});
@@ -3337,13 +3284,6 @@ mod tests {
33373284 assert!((!is_whitespace(~" _ ")));
33383285 }
33393286
3340- #[test]
3341- fn test_is_ascii() {
3342- assert!((is_ascii(~" ")));
3343- assert!((is_ascii(~" a")));
3344- assert!((!is_ascii(~"\u2009 " ) ) ) ;
3345- }
3346-
33473287 #[test]
33483288 fn test_shift_byte() {
33493289 let mut s = ~" ABC ";
0 commit comments