From bb1ed97ca2bbd8efa1555462de3f842d702e8408 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 8 Oct 2012 08:06:25 -0700 Subject: [PATCH] libcore: str trim functions can be applied to &strs --- src/libcore/str.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 285b61149577..d7d33b5528b5 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()) }