| 106 | |
| 107 | |
| 108 | template<class IterT> void splitstring(IterT& iter, const TSTRING& str, const TSTRING& delims) |
| 109 | { |
| 110 | |
| 111 | TSTRING::size_type where; |
| 112 | TSTRING tmpStr; |
| 113 | TSTRING workingString = str; |
| 114 | |
| 115 | while (workingString.length() > 0) |
| 116 | { |
| 117 | |
| 118 | where = workingString.find_first_of(delims, 0); |
| 119 | |
| 120 | // in the case of no delimeters, setp to |
| 121 | // grab the entire string. |
| 122 | // |
| 123 | if (where == TSTRING::npos) |
| 124 | where = workingString.length(); |
| 125 | |
| 126 | tmpStr = workingString.substr(0, where); |
| 127 | workingString.erase(0, where + 1); |
| 128 | |
| 129 | iter.push_back(tmpStr); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | |
| 134 | } // namespace cStringUtil |
no test coverage detected