자바스크립트의 Split 함수와 동일한 역할을 하는 MFC의 CString을 CStringArray을 변환하는 팁입니다.

 

 

CString str = L"AAA*??*BBB*??*CCCC";

CStringArray itemInfors;
 m_Utility.SpliteArray(str,  L"*??*", itemInfors);

 

void CUtility::SpliteArray(CString strData, CString Seperator, CStringArray& arr)

{

           CStringArray datas;

           CString Sep = Seperator;

           CString data = strData;

           int Position = 0;

           CString Token;

                    

           Token = data.Tokenize(Seperator, Position);

           if( Token != L"") arr.Add(Token);

 

           while(!Token.IsEmpty())

           {

                     // Get next token.

                     Token = data.Tokenize(Seperator, Position);

                     if(Token != L"")

                     {

                                arr.Add(Token);

                     }                                         

           }

}