diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2012-10-08 08:06:25 -0700 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2012-10-08 08:08:06 -0700 |
| commit | bb1ed97ca2bbd8efa1555462de3f842d702e8408 (patch) | |
| tree | fb77c8a790145b14c550718f23e42d24b6271d61 /src | |
| parent | ed3689d57c988e1dd477930d957c4308c37d1a64 (diff) | |
| download | rust-bb1ed97ca2bbd8efa1555462de3f842d702e8408.tar.gz rust-bb1ed97ca2bbd8efa1555462de3f842d702e8408.zip | |
libcore: str trim functions can be applied to &strs
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/str.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 285b6114957..d7d33b5528b 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -2195,6 +2195,16 @@ impl &str: StrSlice { #[inline] fn escape_unicode() -> ~str { escape_unicode(self) } + /// Returns a string with leading and trailing whitespace removed + #[inline] + fn trim() -> ~str { trim(self) } + /// Returns a string with leading whitespace removed + #[inline] + fn trim_left() -> ~str { trim_left(self) } + /// Returns a string with trailing whitespace removed + #[inline] + fn trim_right() -> ~str { trim_right(self) } + #[inline] pure fn to_unique() -> ~str { self.slice(0, self.len()) } |
