Split function with std::List

In Addtion to my earlier split function a more optimized method using the std::List.

list splitList(CString str,char delimiter)
{
long len=0;
if(str.IsEmpty())
return NULL;
len=str.GetLength();
list st;
int c=0;
while(1)
{
int pos=str.Find(delimiter);
if(pos!=-1)
{
st.push_back(str.Left(pos));
str.Delete(0,pos+1);
}
else
{
st.push_back(str);
break;
}
c++;
}
return st;
}

Comments

Popular posts from this blog

Welcome to StackEditPro