diff options
author | fluxgen <fluxgen> | 2003-09-29 14:01:48 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-09-29 14:01:48 (GMT) |
commit | 75b3606424a27dafeb0958450bffa841ae463c2d (patch) | |
tree | 87c2521ee380565936c0f3268ac0388456e69d6b /src/FbTk | |
parent | 71504b8bbe636bc49795ca3e94e78a70a2602542 (diff) | |
download | fluxbox_paul-75b3606424a27dafeb0958450bffa841ae463c2d.zip fluxbox_paul-75b3606424a27dafeb0958450bffa841ae463c2d.tar.bz2 |
added removeFirstWhitespace
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/StringUtil.cc | 9 | ||||
-rw-r--r-- | src/FbTk/StringUtil.hh | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index e1af2c2..934561f 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: StringUtil.cc,v 1.6 2003/08/22 22:11:19 fluxgen Exp $ | 22 | // $Id: StringUtil.cc,v 1.7 2003/09/29 14:01:48 fluxgen Exp $ |
23 | 23 | ||
24 | #include "StringUtil.hh" | 24 | #include "StringUtil.hh" |
25 | 25 | ||
@@ -178,6 +178,13 @@ std::string basename(const std::string &filename) { | |||
178 | return filename; | 178 | return filename; |
179 | } | 179 | } |
180 | 180 | ||
181 | string::size_type removeFirstWhitespace(std::string &str) { | ||
182 | string::size_type first_pos = str.find_first_not_of(" \t"); | ||
183 | if (first_pos != string::npos) | ||
184 | str.erase(0, first_pos); | ||
185 | return first_pos; | ||
186 | } | ||
187 | |||
181 | }; // end namespace StringUtil | 188 | }; // end namespace StringUtil |
182 | 189 | ||
183 | }; // end namespace FbTk | 190 | }; // end namespace FbTk |
diff --git a/src/FbTk/StringUtil.hh b/src/FbTk/StringUtil.hh index 621f0fb..6f3b56a 100644 --- a/src/FbTk/StringUtil.hh +++ b/src/FbTk/StringUtil.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | //$Id: StringUtil.hh,v 1.5 2003/08/22 22:11:19 fluxgen Exp $ | 22 | //$Id: StringUtil.hh,v 1.6 2003/09/29 14:01:48 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef FBTK_STRINGUTIL_HH | 24 | #ifndef FBTK_STRINGUTIL_HH |
25 | #define FBTK_STRINGUTIL_HH | 25 | #define FBTK_STRINGUTIL_HH |
@@ -54,6 +54,10 @@ std::string toUpper(const std::string &conv); | |||
54 | #endif // basename | 54 | #endif // basename |
55 | std::string basename(const std::string &basename); | 55 | std::string basename(const std::string &basename); |
56 | 56 | ||
57 | |||
58 | /// removes the first whitespace characters of the string | ||
59 | std::string::size_type removeFirstWhitespace(std::string &str); | ||
60 | |||
57 | /// Breaks a string into tokens | 61 | /// Breaks a string into tokens |
58 | template <typename Container> | 62 | template <typename Container> |
59 | static void | 63 | static void |