Skip to content

Commit bb1ed97

Browse files
committed
libcore: str trim functions can be applied to &strs
1 parent ed3689d commit bb1ed97

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/str.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,16 @@ impl &str: StrSlice {
21952195
#[inline]
21962196
fn escape_unicode() -> ~str { escape_unicode(self) }
21972197

2198+
/// Returns a string with leading and trailing whitespace removed
2199+
#[inline]
2200+
fn trim() -> ~str { trim(self) }
2201+
/// Returns a string with leading whitespace removed
2202+
#[inline]
2203+
fn trim_left() -> ~str { trim_left(self) }
2204+
/// Returns a string with trailing whitespace removed
2205+
#[inline]
2206+
fn trim_right() -> ~str { trim_right(self) }
2207+
21982208
#[inline]
21992209
pure fn to_unique() -> ~str { self.slice(0, self.len()) }
22002210

0 commit comments

Comments
 (0)