Last change
on this file since 1152 was
1152,
checked in by Peter Johansson, 13 years ago
|
allow config file to override svn property (fixes #326). Adding two new files (split.h and split.cc) from yat.
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | // $Id: split.cc 2305 2010-08-02 14:14:32Z peter $ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2010 Peter Johansson |
---|
5 | |
---|
6 | This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
7 | |
---|
8 | The yat library is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU General Public License as |
---|
10 | published by the Free Software Foundation; either version 3 of the |
---|
11 | License, or (at your option) any later version. |
---|
12 | |
---|
13 | The yat library is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | */ |
---|
21 | |
---|
22 | #include "split.h" |
---|
23 | |
---|
24 | #include <string> |
---|
25 | #include <vector> |
---|
26 | |
---|
27 | namespace theplu { |
---|
28 | namespace yat { |
---|
29 | namespace utility { |
---|
30 | |
---|
31 | void split(std::vector<std::string>& vec, const std::string& str, char delim) |
---|
32 | { |
---|
33 | size_t pos=0; |
---|
34 | while (true) { |
---|
35 | size_t end = str.find_first_of(delim, pos); |
---|
36 | vec.push_back(str.substr(pos, end-pos)); |
---|
37 | if (end == std::string::npos) |
---|
38 | break; |
---|
39 | pos = end+1; |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | }}} // of namespace utility, yat, and theplu |
---|
Note: See
TracBrowser
for help on using the repository browser.