all repos — fluxbox @ 75b3606424a27dafeb0958450bffa841ae463c2d

custom fork of the fluxbox windowmanager

added removeFirstWhitespace
fluxgen fluxgen
commit

75b3606424a27dafeb0958450bffa841ae463c2d

parent

71504b8bbe636bc49795ca3e94e78a70a2602542

2 files changed, 13 insertions(+), 2 deletions(-)

jump to
M src/FbTk/StringUtil.ccsrc/FbTk/StringUtil.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: StringUtil.cc,v 1.6 2003/08/22 22:11:19 fluxgen Exp $ +// $Id: StringUtil.cc,v 1.7 2003/09/29 14:01:48 fluxgen Exp $ #include "StringUtil.hh"

@@ -176,6 +176,13 @@ std::string::size_type first_pos = filename.find_last_of("/");

if (first_pos != std::string::npos) return filename.substr(first_pos + 1); return filename; +} + +string::size_type removeFirstWhitespace(std::string &str) { + string::size_type first_pos = str.find_first_not_of(" \t"); + if (first_pos != string::npos) + str.erase(0, first_pos); + return first_pos; } }; // end namespace StringUtil
M src/FbTk/StringUtil.hhsrc/FbTk/StringUtil.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: StringUtil.hh,v 1.5 2003/08/22 22:11:19 fluxgen Exp $ +//$Id: StringUtil.hh,v 1.6 2003/09/29 14:01:48 fluxgen Exp $ #ifndef FBTK_STRINGUTIL_HH #define FBTK_STRINGUTIL_HH

@@ -53,6 +53,10 @@ #ifdef basename

#undef basename #endif // basename std::string basename(const std::string &basename); + + +/// removes the first whitespace characters of the string +std::string::size_type removeFirstWhitespace(std::string &str); /// Breaks a string into tokens template <typename Container>