| 932 | typename alloc |
| 933 | > |
| 934 | const std::vector<std::basic_string<charT,traits,alloc> > split ( |
| 935 | const std::basic_string<charT,traits,alloc>& str, |
| 936 | const charT* delim = _dT(charT," \n\r\t") |
| 937 | ) |
| 938 | { |
| 939 | std::basic_string<charT,traits,alloc> temp; |
| 940 | |
| 941 | std::vector<std::basic_string<charT,traits,alloc> > res; |
| 942 | |
| 943 | for (unsigned long i = 0; i < str.size(); ++i) |
| 944 | { |
| 945 | // check if delim contains the character str[i] |
| 946 | bool hit = false; |
| 947 | const charT* d = delim; |
| 948 | while (*d != '\0') |
| 949 | { |
| 950 | if (str[i] == *d) |
| 951 | { |
| 952 | hit = true; |
| 953 | break; |
| 954 | } |
| 955 | ++d; |
| 956 | } |
| 957 | |
| 958 | if (hit) |
| 959 | { |
| 960 | if (temp.size() != 0) |
| 961 | { |
| 962 | res.push_back(temp); |
| 963 | temp.clear(); |
| 964 | } |
| 965 | } |
| 966 | else |
| 967 | { |
| 968 | temp.push_back(str[i]); |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | if (temp.size() != 0) |
| 973 | res.push_back(temp); |
| 974 | |
| 975 | return res; |
| 976 | } |
| 977 | |
| 978 | template < |
| 979 | typename charT, |