@@ -787,22 +787,6 @@ pub fn each_split_within<'a>(ss: &'a str,
787
787
}
788
788
}
789
789
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
-
806
790
/**
807
791
* Replace all occurrences of one string with another
808
792
*
@@ -1610,13 +1594,6 @@ pub fn ends_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
1610
1594
Section: String properties
1611
1595
*/
1612
1596
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
-
1620
1597
/// Returns true if the string has length 0
1621
1598
pub fn is_empty ( s : & str ) -> bool { len ( s) == 0 u }
1622
1599
@@ -2403,8 +2380,6 @@ pub trait StrSlice<'self> {
2403
2380
fn each_split_str<'a>(&self, sep: &'a str, it: &fn(&'self str) -> bool);
2404
2381
fn starts_with<'a>(&self, needle: &'a str) -> bool;
2405
2382
fn substr(&self, begin: uint, n: uint) -> &'self str;
2406
- fn to_lower(&self) -> ~str;
2407
- fn to_upper(&self) -> ~str;
2408
2383
fn escape_default(&self) -> ~str;
2409
2384
fn escape_unicode(&self) -> ~str;
2410
2385
fn trim(&self) -> &'self str;
@@ -2565,12 +2540,6 @@ impl<'self> StrSlice<'self> for &'self str {
2565
2540
fn substr(&self, begin: uint, n: uint) -> &'self str {
2566
2541
substr(*self, begin, n)
2567
2542
}
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) }
2574
2543
/// Escape each char in `s` with char::escape_default.
2575
2544
#[inline]
2576
2545
fn escape_default(&self) -> ~str { escape_default(*self) }
@@ -3084,27 +3053,6 @@ mod tests {
3084
3053
assert!(repeat(~" hi", 0) == ~" ");
3085
3054
}
3086
3055
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
-
3108
3056
#[test]
3109
3057
fn test_unsafe_slice() {
3110
3058
assert!(" ab" == unsafe {raw::slice_bytes(" abc", 0, 2)});
@@ -3337,13 +3285,6 @@ mod tests {
3337
3285
assert!((!is_whitespace(~" _ ")));
3338
3286
}
3339
3287
3340
- #[test]
3341
- fn test_is_ascii() {
3342
- assert!((is_ascii(~" ")));
3343
- assert!((is_ascii(~" a")));
3344
- assert!((!is_ascii(~"\u2009 " ) ) ) ;
3345
- }
3346
-
3347
3288
#[test]
3348
3289
fn test_shift_byte() {
3349
3290
let mut s = ~" ABC ";
0 commit comments