@@ -313,7 +313,7 @@ pub fn unshift_char(s: &mut ~str, ch: char) {
313
313
* * chars_to_trim - A vector of chars
314
314
*
315
315
*/
316
- pub pure fn trim_left_chars_DBGBRWD ( s : & ' a str , chars_to_trim : & [ char ] ) -> & ' a str {
316
+ pub pure fn trim_left_chars ( s : & ' a str , chars_to_trim : & [ char ] ) -> & ' a str {
317
317
if chars_to_trim. is_empty ( ) { return s; }
318
318
319
319
match find ( s, |c| !chars_to_trim. contains ( & c) ) {
@@ -331,7 +331,7 @@ pub pure fn trim_left_chars_DBGBRWD(s: &'a str, chars_to_trim: &[char]) -> &'a s
331
331
* * chars_to_trim - A vector of chars
332
332
*
333
333
*/
334
- pub pure fn trim_right_chars_DBGBRWD ( s : & ' a str , chars_to_trim : & [ char ] ) -> & ' a str {
334
+ pub pure fn trim_right_chars ( s : & ' a str , chars_to_trim : & [ char ] ) -> & ' a str {
335
335
if chars_to_trim. is_empty ( ) { return s; }
336
336
337
337
match rfind ( s, |c| !chars_to_trim. contains ( & c) ) {
@@ -352,20 +352,20 @@ pub pure fn trim_right_chars_DBGBRWD(s: &'a str, chars_to_trim: &[char]) -> &'a
352
352
* * chars_to_trim - A vector of chars
353
353
*
354
354
*/
355
- pub pure fn trim_chars_DBGBRWD ( s : & ' a str , chars_to_trim : & [ char ] ) -> & ' a str {
356
- trim_left_chars_DBGBRWD ( trim_right_chars_DBGBRWD ( s, chars_to_trim) , chars_to_trim)
355
+ pub pure fn trim_chars ( s : & ' a str , chars_to_trim : & [ char ] ) -> & ' a str {
356
+ trim_left_chars ( trim_right_chars ( s, chars_to_trim) , chars_to_trim)
357
357
}
358
358
359
359
/// Returns a string with leading whitespace removed
360
- pub pure fn trim_left_DBGBRWD ( s : & ' a str ) -> & ' a str {
360
+ pub pure fn trim_left ( s : & ' a str ) -> & ' a str {
361
361
match find ( s, |c| !char:: is_whitespace ( c) ) {
362
362
None => "" ,
363
363
Some ( first) => unsafe { raw:: slice_bytes ( s, first, len ( s) ) }
364
364
}
365
365
}
366
366
367
367
/// Returns a string with trailing whitespace removed
368
- pub pure fn trim_right_DBGBRWD ( s : & ' a str ) -> & ' a str {
368
+ pub pure fn trim_right ( s : & ' a str ) -> & ' a str {
369
369
match rfind ( s, |c| !char:: is_whitespace ( c) ) {
370
370
None => "" ,
371
371
Some ( last) => {
@@ -376,7 +376,7 @@ pub pure fn trim_right_DBGBRWD(s: &'a str) -> &'a str {
376
376
}
377
377
378
378
/// Returns a string with leading and trailing whitespace removed
379
- pub pure fn trim_DBGBRWD ( s : & ' a str ) -> & ' a str { trim_left_DBGBRWD ( trim_right_DBGBRWD ( s) ) }
379
+ pub pure fn trim ( s : & ' a str ) -> & ' a str { trim_left ( trim_right ( s) ) }
380
380
381
381
/*
382
382
Section: Transforming strings
@@ -421,7 +421,7 @@ pub pure fn chars(s: &str) -> ~[char] {
421
421
* Returns a string containing `n` characters starting at byte offset
422
422
* `begin`.
423
423
*/
424
- pub pure fn substr_DBGBRWD ( s : & ' a str , begin : uint , n : uint ) -> & ' a str {
424
+ pub pure fn substr ( s : & ' a str , begin : uint , n : uint ) -> & ' a str {
425
425
slice ( s, begin, begin + count_bytes ( s, begin, n) )
426
426
}
427
427
@@ -2275,17 +2275,17 @@ pub trait StrSlice {
2275
2275
pure fn split_char(&self, sep: char) -> ~[~str];
2276
2276
pure fn split_str(&self, sep: &'a str) -> ~[~str];
2277
2277
pure fn starts_with(&self, needle: &'a str) -> bool;
2278
- pure fn substr_DBGBRWD (&self, begin: uint, n: uint) -> &'self str;
2278
+ pure fn substr (&self, begin: uint, n: uint) -> &'self str;
2279
2279
pure fn to_lower(&self) -> ~str;
2280
2280
pure fn to_upper(&self) -> ~str;
2281
2281
pure fn escape_default(&self) -> ~str;
2282
2282
pure fn escape_unicode(&self) -> ~str;
2283
- pure fn trim_DBGBRWD (&self) -> &'self str;
2284
- pure fn trim_left_DBGBRWD (&self) -> &'self str;
2285
- pure fn trim_right_DBGBRWD (&self) -> &'self str;
2286
- pure fn trim_chars_DBGBRWD (&self, chars_to_trim: &[char]) -> &'self str;
2287
- pure fn trim_left_chars_DBGBRWD (&self, chars_to_trim: &[char]) -> &'self str;
2288
- pure fn trim_right_chars_DBGBRWD (&self, chars_to_trim: &[char]) -> &'self str;
2283
+ pure fn trim (&self) -> &'self str;
2284
+ pure fn trim_left (&self) -> &'self str;
2285
+ pure fn trim_right (&self) -> &'self str;
2286
+ pure fn trim_chars (&self, chars_to_trim: &[char]) -> &'self str;
2287
+ pure fn trim_left_chars (&self, chars_to_trim: &[char]) -> &'self str;
2288
+ pure fn trim_right_chars (&self, chars_to_trim: &[char]) -> &'self str;
2289
2289
pure fn to_owned(&self) -> ~str;
2290
2290
pure fn to_managed(&self) -> @str;
2291
2291
pure fn char_at(&self, i: uint) -> char;
@@ -2419,8 +2419,8 @@ impl StrSlice for &'self str {
2419
2419
* `begin`.
2420
2420
*/
2421
2421
#[inline]
2422
- pure fn substr_DBGBRWD (&self, begin: uint, n: uint) -> &'self str {
2423
- substr_DBGBRWD (*self, begin, n)
2422
+ pure fn substr (&self, begin: uint, n: uint) -> &'self str {
2423
+ substr (*self, begin, n)
2424
2424
}
2425
2425
/// Convert a string to lowercase
2426
2426
#[inline]
@@ -2437,25 +2437,25 @@ impl StrSlice for &'self str {
2437
2437
2438
2438
/// Returns a string with leading and trailing whitespace removed
2439
2439
#[inline]
2440
- pure fn trim_DBGBRWD (&self) -> &'self str { trim_DBGBRWD (*self) }
2440
+ pure fn trim (&self) -> &'self str { trim (*self) }
2441
2441
/// Returns a string with leading whitespace removed
2442
2442
#[inline]
2443
- pure fn trim_left_DBGBRWD (&self) -> &'self str { trim_left_DBGBRWD (*self) }
2443
+ pure fn trim_left (&self) -> &'self str { trim_left (*self) }
2444
2444
/// Returns a string with trailing whitespace removed
2445
2445
#[inline]
2446
- pure fn trim_right_DBGBRWD (&self) -> &'self str { trim_right_DBGBRWD (*self) }
2446
+ pure fn trim_right (&self) -> &'self str { trim_right (*self) }
2447
2447
2448
2448
#[inline]
2449
- pure fn trim_chars_DBGBRWD (&self, chars_to_trim: &[char]) -> &'self str {
2450
- trim_chars_DBGBRWD (*self, chars_to_trim)
2449
+ pure fn trim_chars (&self, chars_to_trim: &[char]) -> &'self str {
2450
+ trim_chars (*self, chars_to_trim)
2451
2451
}
2452
2452
#[inline]
2453
- pure fn trim_left_chars_DBGBRWD (&self, chars_to_trim: &[char]) -> &'self str {
2454
- trim_left_chars_DBGBRWD (*self, chars_to_trim)
2453
+ pure fn trim_left_chars (&self, chars_to_trim: &[char]) -> &'self str {
2454
+ trim_left_chars (*self, chars_to_trim)
2455
2455
}
2456
2456
#[inline]
2457
- pure fn trim_right_chars_DBGBRWD (&self, chars_to_trim: &[char]) -> &'self str {
2458
- trim_right_chars_DBGBRWD (*self, chars_to_trim)
2457
+ pure fn trim_right_chars (&self, chars_to_trim: &[char]) -> &'self str {
2458
+ trim_right_chars (*self, chars_to_trim)
2459
2459
}
2460
2460
2461
2461
@@ -2817,11 +2817,11 @@ mod tests {
2817
2817
#[ test]
2818
2818
fn test_substr( ) {
2819
2819
fn t( a: & str , b: & str , start: int) {
2820
- fail_unless!( substr_DBGBRWD ( a, start as uint, len( b) ) == b) ;
2820
+ fail_unless!( substr ( a, start as uint, len( b) ) == b) ;
2821
2821
}
2822
2822
t( "hello", "llo", 2 ) ;
2823
2823
t( "hello", "el", 1 ) ;
2824
- fail_unless!( "ะเทศไท" == substr_DBGBRWD ( "ประเทศไทย中华Việt Nam ", 6 u, 6 u) ) ;
2824
+ fail_unless!( "ะเทศไท" == substr ( "ประเทศไทย中华Việt Nam ", 6 u, 6 u) ) ;
2825
2825
}
2826
2826
2827
2827
#[ test]
@@ -3054,62 +3054,62 @@ mod tests {
3054
3054
3055
3055
#[ test]
3056
3056
fn test_trim_left_chars( ) {
3057
- fail_unless!( trim_left_chars_DBGBRWD ( " * * * foo * * * ", ~[ ] ) ==
3057
+ fail_unless!( trim_left_chars ( " * * * foo * * * ", ~[ ] ) ==
3058
3058
" * * * foo * * * ") ;
3059
- fail_unless!( trim_left_chars_DBGBRWD ( " * * * foo * * * ", ~[ '*' , ' ' ] ) ==
3059
+ fail_unless!( trim_left_chars ( " * * * foo * * * ", ~[ '*' , ' ' ] ) ==
3060
3060
"foo * * * ") ;
3061
- fail_unless!( trim_left_chars_DBGBRWD ( " * * * * * * ", ~[ '*' , ' ' ] ) == "") ;
3062
- fail_unless!( trim_left_chars_DBGBRWD ( "foo * * * ", ~[ '*' , ' ' ] ) ==
3061
+ fail_unless!( trim_left_chars ( " * * * * * * ", ~[ '*' , ' ' ] ) == "") ;
3062
+ fail_unless!( trim_left_chars ( "foo * * * ", ~[ '*' , ' ' ] ) ==
3063
3063
"foo * * * ") ;
3064
3064
}
3065
3065
3066
3066
#[ test]
3067
3067
fn test_trim_right_chars( ) {
3068
- fail_unless!( trim_right_chars_DBGBRWD ( " * * * foo * * * ", ~[ ] ) ==
3068
+ fail_unless!( trim_right_chars ( " * * * foo * * * ", ~[ ] ) ==
3069
3069
" * * * foo * * * ") ;
3070
- fail_unless!( trim_right_chars_DBGBRWD ( " * * * foo * * * ", ~[ '*' , ' ' ] ) ==
3070
+ fail_unless!( trim_right_chars ( " * * * foo * * * ", ~[ '*' , ' ' ] ) ==
3071
3071
" * * * foo") ;
3072
- fail_unless!( trim_right_chars_DBGBRWD ( " * * * * * * ", ~[ '*' , ' ' ] ) == "") ;
3073
- fail_unless!( trim_right_chars_DBGBRWD ( " * * * foo", ~[ '*' , ' ' ] ) ==
3072
+ fail_unless!( trim_right_chars ( " * * * * * * ", ~[ '*' , ' ' ] ) == "") ;
3073
+ fail_unless!( trim_right_chars ( " * * * foo", ~[ '*' , ' ' ] ) ==
3074
3074
" * * * foo") ;
3075
3075
}
3076
3076
3077
3077
#[ test]
3078
3078
fn test_trim_chars( ) {
3079
- fail_unless!( trim_chars_DBGBRWD ( " * * * foo * * * ", ~[ ] ) == " * * * foo * * * ") ;
3080
- fail_unless!( trim_chars_DBGBRWD ( " * * * foo * * * ", ~[ '*' , ' ' ] ) == "foo") ;
3081
- fail_unless!( trim_chars_DBGBRWD ( " * * * * * * ", ~[ '*' , ' ' ] ) == "") ;
3082
- fail_unless!( trim_chars_DBGBRWD ( "foo", ~[ '*' , ' ' ] ) == "foo") ;
3079
+ fail_unless!( trim_chars ( " * * * foo * * * ", ~[ ] ) == " * * * foo * * * ") ;
3080
+ fail_unless!( trim_chars ( " * * * foo * * * ", ~[ '*' , ' ' ] ) == "foo") ;
3081
+ fail_unless!( trim_chars ( " * * * * * * ", ~[ '*' , ' ' ] ) == "") ;
3082
+ fail_unless!( trim_chars ( "foo", ~[ '*' , ' ' ] ) == "foo") ;
3083
3083
}
3084
3084
3085
3085
#[ test]
3086
3086
fn test_trim_left( ) {
3087
- fail_unless!( ( trim_left_DBGBRWD ( "") == "") ) ;
3088
- fail_unless!( ( trim_left_DBGBRWD ( "a") == "a") ) ;
3089
- fail_unless!( ( trim_left_DBGBRWD ( " ") == "") ) ;
3090
- fail_unless!( ( trim_left_DBGBRWD ( " blah") == "blah") ) ;
3091
- fail_unless!( ( trim_left_DBGBRWD ( " \u3000 wut") == "wut") ) ;
3092
- fail_unless!( ( trim_left_DBGBRWD ( "hey ") == "hey ") ) ;
3087
+ fail_unless!( ( trim_left ( "") == "") ) ;
3088
+ fail_unless!( ( trim_left ( "a") == "a") ) ;
3089
+ fail_unless!( ( trim_left ( " ") == "") ) ;
3090
+ fail_unless!( ( trim_left ( " blah") == "blah") ) ;
3091
+ fail_unless!( ( trim_left ( " \u3000 wut") == "wut") ) ;
3092
+ fail_unless!( ( trim_left ( "hey ") == "hey ") ) ;
3093
3093
}
3094
3094
3095
3095
#[ test]
3096
3096
fn test_trim_right( ) {
3097
- fail_unless!( ( trim_right_DBGBRWD ( "") == "") ) ;
3098
- fail_unless!( ( trim_right_DBGBRWD ( "a") == "a") ) ;
3099
- fail_unless!( ( trim_right_DBGBRWD ( " ") == "") ) ;
3100
- fail_unless!( ( trim_right_DBGBRWD ( "blah ") == "blah") ) ;
3101
- fail_unless!( ( trim_right_DBGBRWD ( "wut \u3000 ") == "wut") ) ;
3102
- fail_unless!( ( trim_right_DBGBRWD ( " hey") == " hey") ) ;
3097
+ fail_unless!( ( trim_right ( "") == "") ) ;
3098
+ fail_unless!( ( trim_right ( "a") == "a") ) ;
3099
+ fail_unless!( ( trim_right ( " ") == "") ) ;
3100
+ fail_unless!( ( trim_right ( "blah ") == "blah") ) ;
3101
+ fail_unless!( ( trim_right ( "wut \u3000 ") == "wut") ) ;
3102
+ fail_unless!( ( trim_right ( " hey") == " hey") ) ;
3103
3103
}
3104
3104
3105
3105
#[ test]
3106
3106
fn test_trim( ) {
3107
- fail_unless!( ( trim_DBGBRWD ( "") == "") ) ;
3108
- fail_unless!( ( trim_DBGBRWD ( "a") == "a") ) ;
3109
- fail_unless!( ( trim_DBGBRWD ( " ") == "") ) ;
3110
- fail_unless!( ( trim_DBGBRWD ( " blah ") == "blah") ) ;
3111
- fail_unless!( ( trim_DBGBRWD ( "\n wut \u3000 ") == "wut") ) ;
3112
- fail_unless!( ( trim_DBGBRWD ( " hey dude ") == "hey dude") ) ;
3107
+ fail_unless!( ( trim ( "") == "") ) ;
3108
+ fail_unless!( ( trim ( "a") == "a") ) ;
3109
+ fail_unless!( ( trim ( " ") == "") ) ;
3110
+ fail_unless!( ( trim ( " blah ") == "blah") ) ;
3111
+ fail_unless!( ( trim ( "\n wut \u3000 ") == "wut") ) ;
3112
+ fail_unless!( ( trim ( " hey dude ") == "hey dude") ) ;
3113
3113
}
3114
3114
3115
3115
#[ test]
0 commit comments