diff options
Diffstat (limited to 'src/StringUtil.hh')
-rw-r--r-- | src/StringUtil.hh | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/StringUtil.hh b/src/StringUtil.hh index a77dbf0..68c8440 100644 --- a/src/StringUtil.hh +++ b/src/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.10 2002/09/15 09:40:26 fluxgen Exp $ | 22 | //$Id: StringUtil.hh,v 1.11 2002/12/01 13:41:59 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef STRINGUTIL_HH | 24 | #ifndef STRINGUTIL_HH |
25 | #define STRINGUTIL_HH | 25 | #define STRINGUTIL_HH |
@@ -36,7 +36,7 @@ const char *strcasestr(const char *str, const char *ptn); | |||
36 | 36 | ||
37 | std::string expandFilename(const std::string &filename); | 37 | std::string expandFilename(const std::string &filename); |
38 | int getStringBetween(std::string& out, const char *instr, const char first, const char last, | 38 | int getStringBetween(std::string& out, const char *instr, const char first, const char last, |
39 | const char *ok_chars=" \t\n"); | 39 | const char *ok_chars=" \t\n"); |
40 | 40 | ||
41 | void toLower(char * const conv); | 41 | void toLower(char * const conv); |
42 | 42 | ||
@@ -46,30 +46,30 @@ void toLower(char * const conv); | |||
46 | template <typename Container> | 46 | template <typename Container> |
47 | static void | 47 | static void |
48 | stringtok (Container &container, std::string const &in, | 48 | stringtok (Container &container, std::string const &in, |
49 | const char * const delimiters = " \t\n") | 49 | const char * const delimiters = " \t\n") |
50 | { | 50 | { |
51 | const std::string::size_type len = in.length(); | 51 | const std::string::size_type len = in.length(); |
52 | std::string::size_type i = 0; | 52 | std::string::size_type i = 0; |
53 | 53 | ||
54 | while ( i < len ) { | 54 | while ( i < len ) { |
55 | // eat leading whitespace | 55 | // eat leading whitespace |
56 | i = in.find_first_not_of(delimiters, i); | 56 | i = in.find_first_not_of(delimiters, i); |
57 | if (i == std::string::npos) | 57 | if (i == std::string::npos) |
58 | return; // nothing left but white space | 58 | return; // nothing left but white space |
59 | 59 | ||
60 | // find the end of the token | 60 | // find the end of the token |
61 | std::string::size_type j = in.find_first_of(delimiters, i); | 61 | std::string::size_type j = in.find_first_of(delimiters, i); |
62 | 62 | ||
63 | // push token | 63 | // push token |
64 | if (j == std::string::npos) { | 64 | if (j == std::string::npos) { |
65 | container.push_back(in.substr(i)); | 65 | container.push_back(in.substr(i)); |
66 | return; | 66 | return; |
67 | } else | 67 | } else |
68 | container.push_back(in.substr(i, j-i)); | 68 | container.push_back(in.substr(i, j-i)); |
69 | 69 | ||
70 | // set up for next loop | 70 | // set up for next loop |
71 | i = j + 1; | 71 | i = j + 1; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | };//end namespace StringUtil | 75 | };//end namespace StringUtil |