12 inline void words(
const std::string& a_string,
const std::string& a_sep,
bool a_take_empty,
13 std::vector<std::string>& a_words,
bool a_clear =
true){
18 if(a_clear) a_words.clear();
19 if(a_string.empty())
return;
20 std::string::size_type lim = (a_take_empty?0:1);
22 a_words.push_back(a_string);
24 std::string::size_type l = a_string.length();
25 std::string::size_type llimiter = a_sep.length();
26 std::string::size_type pos = 0;
28 std::string::size_type index = a_string.find(a_sep,pos);
29 if(index==std::string::npos){
30 if((l-pos)>=lim) a_words.push_back(a_string.substr(pos,l-pos));
35 if((index-pos)>=lim) a_words.push_back(a_string.substr(pos,index-pos));
36 pos = index + llimiter;
42 #ifdef TOOLS_DEPRECATED
43 inline std::vector<std::string>
words(
const std::string& a_string,
const std::string& a_limiter,
bool a_take_empty =
false){
44 std::vector<std::string> v;
45 words(a_string,a_limiter,a_take_empty,v);
48 #endif //TOOLS_DEPRECATED
50 inline void words(
const std::string& a_string,
51 const std::string& a_sep,
bool a_take_empty,
54 std::string::size_type a_wps[],
55 std::string::size_type a_wls[]){
58 if(a_string.empty())
return;
59 std::string::size_type lim = (a_take_empty?0:1);
63 a_wls[a_wn] = a_string.length();
66 std::string::size_type l = a_string.length();
67 std::string::size_type llimiter = a_sep.length();
68 std::string::size_type pos = 0;
70 std::string::size_type index = a_string.find(a_sep,pos);
71 if(index==std::string::npos){
82 if((index-pos)>=lim) {
85 a_wls[a_wn] = index-pos;
88 pos = index + llimiter;