summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools.cpp b/tools.cpp
index 677ce02..fff3483 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -108,4 +108,17 @@ string StringEscapeAndBreak( string const& input )
return StringReplace( plainBuilder.str(), "\n", "<br/>" );
}
+string StringTrim(string const& str)
+{
+ string res = str;
+ string::size_type pos = res.find_last_not_of(' ');
+ if(pos != string::npos) {
+ res.erase(pos + 1);
+ pos = res.find_first_not_of(' ');
+ if(pos != string::npos) res.erase(0, pos);
+ }
+ else res.erase(res.begin(), res.end());
+ return res;
+}
+
} // namespace vdrlive