str_separate

 

Description

Seperate the string to some new strings with the seperator.

Syntax

int str_separate( LPCSTR lpcszStr, LPCSTR lcpszSep, vector<string> & vsSections )

Parameters

lpcszStr
[Input] The string will be seperated.
lcpszSep
[Input] The seperator string.
vsSections
[Output] The output string vector

Return

Return the size of the output string vector.

Examples

EX1

void str_separate_ex1()
{
    vector<string> vsSections;
    string strOriginal = "The United States\r\nChina\r\nJapan\r\nOrigin is Good";
    string strSep = "\r\n";
    int iSecNum = str_separate(strOriginal,strSep, vsSections);
    if(iSecNum)
    {
                printf("after separated:\n");
                for(int ii=0; ii<vsSections.GetSize(); ii++)
                printf("%s\n",vsSections[ii]);
    }
    else
        printf("Separate failed\n");
}

Remark

See Also

str_combine

header to Include

origin.h

Reference