Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-31 11:43:46 +0000
committerStijn Buys <ingar@osirion.org>2008-05-31 11:43:46 +0000
commit2a41efa0d43b573e1c8851086268b8a64d51c511 (patch)
tree1727c8aeb8b540ee4990bd92c0e8158a409b9397 /src/auxiliary
parent4b527153ccf2a2830e38038ce4cf06ccc764d310 (diff)
fixes zlib compression, infi file parser updates
Diffstat (limited to 'src/auxiliary')
-rw-r--r--src/auxiliary/functions.cc10
-rw-r--r--src/auxiliary/functions.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/auxiliary/functions.cc b/src/auxiliary/functions.cc
index e9861ac..5edff56 100644
--- a/src/auxiliary/functions.cc
+++ b/src/auxiliary/functions.cc
@@ -122,4 +122,14 @@ const std::string lowercase(const std::string &text)
return t;
}
+void trim(std::string &text)
+{
+ while (text.size() && text[0] == ' ') {
+ text.erase(0, 1);
+ }
+ while (text.size() && text[text.size()-1] == ' ') {
+ text.erase(text.size()-1, 1);
+ }
+}
+
}
diff --git a/src/auxiliary/functions.h b/src/auxiliary/functions.h
index 90eb2ed..ceab0de 100644
--- a/src/auxiliary/functions.h
+++ b/src/auxiliary/functions.h
@@ -49,6 +49,9 @@ const std::string text_strip(const std::string &text);
/// return text, stripped of color codes and converted to lowercase
const std::string text_strip_lowercase(const std::string &text);
+/// trim leading ad trailing spaces from a string
+void trim(std::string &text);
+
}
#endif // __INCLUDED_AUX_FUNCTIONS_H__