From 2a41efa0d43b573e1c8851086268b8a64d51c511 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 31 May 2008 11:43:46 +0000 Subject: fixes zlib compression, infi file parser updates --- src/auxiliary/functions.cc | 10 ++++++++++ src/auxiliary/functions.h | 3 +++ 2 files changed, 13 insertions(+) (limited to 'src/auxiliary') 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__ -- cgit v1.2.3