8 #ifndef VINA_TOKENIZE_H
9 #define VINA_TOKENIZE_H
18 template <
class ContainerT >
19 void tokenize(
const std::string& str, ContainerT& tokens,
20 const std::string& delimiters =
" ",
const bool trimEmpty =
true) {
21 typedef ContainerT Base;
22 typedef typename Base::value_type ValueType;
23 typedef typename ValueType::size_type SizeType;
24 SizeType pos, lastPos = 0;
26 pos = str.find_first_of(delimiters, lastPos);
27 if (pos == std::string::npos) {
30 if (pos != lastPos || !trimEmpty)
31 tokens.push_back(ValueType(str.data() + lastPos, (SizeType)pos - lastPos));
35 if (pos != lastPos || !trimEmpty)
36 tokens.push_back(ValueType(str.data() + lastPos, (SizeType)pos - lastPos));
44 template <
typename T1,
typename T2>