strSplit分隔文本以container返回

public container strSplit(str _stringToSplit, str _delimiters)
{
    container c;
    int oldPos = 1;
    int pos;
    int strLength = strlen(_stringToSplit);

    do
    {
        pos = strfind(_stringToSplit, _delimiters, oldPos, strLength);
        if (!pos)
            pos = strLength+1;
        c = conins(c,conlen(c)+1,strreplace(substr(_stringToSplit, oldPos, pos-oldPos),"\r",""));
        oldPos = pos+1;
    } while (pos <= strLength);

    return c;
}

posted @ 2011-10-07 12:19  perock  阅读(266)  评论(0编辑  收藏  举报