diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-31 11:43:46 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-31 11:43:46 +0000 |
commit | 2a41efa0d43b573e1c8851086268b8a64d51c511 (patch) | |
tree | 1727c8aeb8b540ee4990bd92c0e8158a409b9397 /src/auxiliary | |
parent | 4b527153ccf2a2830e38038ce4cf06ccc764d310 (diff) |
fixes zlib compression, infi file parser updates
Diffstat (limited to 'src/auxiliary')
-rw-r--r-- | src/auxiliary/functions.cc | 10 | ||||
-rw-r--r-- | src/auxiliary/functions.h | 3 |
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__ |