diff options
author | John Denker <jsd@av8n.com> | 2012-07-29 17:00:15 -0700 |
---|---|---|
committer | John Denker <jsd@av8n.com> | 2012-07-29 17:00:15 -0700 |
commit | 63be414b62f3234ad80607b95e8e71e33bfd8025 (patch) | |
tree | ba9ed3dbc8508f64cddc09e3d0c59c2e635de061 /tools/utils.c | |
parent | d2564d25e802d1ee3230cf045c4940e836b5c6a2 (diff) |
move more stuff to utils.c ... I hate duplication of code
Diffstat (limited to 'tools/utils.c')
-rw-r--r-- | tools/utils.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/utils.c b/tools/utils.c index 3ec6e4c..aecbfda 100644 --- a/tools/utils.c +++ b/tools/utils.c @@ -42,3 +42,19 @@ using namespace std; foo << setw(didsome?2:1) << setfill('0') << sec; return foo.str(); } + +std::string toLower(const std::string a){ + std::string rslt = a; + std::string::iterator rr; + for (rr = rslt.begin(); rr != rslt.end(); rr++){ + *rr = tolower(*rr); + } + return rslt; +} + +//////////////// +std::string ltrim(const std::string foo){ + size_t where = foo.find_first_not_of(" \t\r\n"); + if (where == foo.npos) return foo; + return foo.substr(where); +} |