MCPcopy Create free account
hub / github.com/AnetaTexler/FaceBlit / split

Function split

VS/include/dlib/string/string.h:934–976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,

Callers 6

alphaBlendTransparentBGFunction · 0.50
test_splitFunction · 0.50
mexFunctionFunction · 0.50
match_endingsMethod · 0.50
splitMethod · 0.50
backwardMethod · 0.50

Calls 3

sizeMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by 1

test_splitFunction · 0.40