41 #ifndef TF_STRINGFUNC_H_VERSION 43 #define TF_STRINGFUNC_H_VERSION \ 44 "TF_STRINGFUNC_H V1.2" 70 template<
template<
class>
class C>
71 std::string
join(
const C<std::string>& v,
72 const std::string& delimiter=
"")
75 for (
typename C<std::string>::const_iterator i=v.begin();
77 { retval.append(*i); retval.append(delimiter); }
113 const std::string& delimiter=
" ",
114 const bool& dropdelimiter=
false)
118 std::string::size_type posend=0, pos=0;
119 std::string::size_type len=0;
120 while (posend!=std::string::npos) {
121 posend=s.find(delimiter, pos);
124 v.push_back(s.substr(pos, len));
125 if (posend!=std::string::npos) { len+=delimiter.length(); }
127 if (posend!=std::string::npos) { len+=delimiter.length(); }
128 v.push_back(s.substr(pos, len));
158 template<
template<
class>
class C>
159 C<std::string>
split(
const std::string& s,
160 const std::string& delimiter=
" ",
161 const bool& dropdelimiter=
false)
164 gen_split(v, s, delimiter, dropdelimiter);
206 std::string
trimws(std::string s);
214 std::string
strip_string(std::string& s,
const char& delim=
',');
222 int count_char(
const std::string& s,
const char& c);
232 std::string
patsubst(
const std::string& s,
233 const std::string& p,
234 const std::string& r);
240 #endif // TF_STRINGFUNC_H_VERSION (includeguard) std::string trimws(std::string s)
std::string strip_string(std::string &s, const char &delim)
std::string patsubst(const std::string &s, const std::string &p, const std::string &r)
void gen_split(C &v, const std::string &s, const std::string &delimiter=" ", const bool &dropdelimiter=false)
std::string trimws_begin(std::string s)
std::string trimws_end(std::string s)
std::string join(const C< std::string > &v, const std::string &delimiter="")
int count_char(const std::string &s, const char &c)
C< std::string > split(const std::string &s, const std::string &delimiter=" ", const bool &dropdelimiter=false)
Namespace containing all code of library libtfxx.