Logo Search packages:      
Sourcecode: inkscape version File versions

std::vector< String > buildtool::MakeBase::tokenize ( const String &  str,
const String &  delimiters 
) [protected, inherited]

Break up a string into substrings delimited the characters in delimiters. Null-length substrings are ignored

Definition at line 3247 of file buildtool.cpp.

{

    std::vector<String> res;
    char *del = (char *)delimiters.c_str();
    String dmp;
    for (unsigned int i=0 ; i<str.size() ; i++)
        {
        char ch = str[i];
        char *p = (char *)0;
        for (p=del ; *p ; p++)
            if (*p == ch)
                break;
        if (*p)
            {
            if (dmp.size() > 0)
                {
                res.push_back(dmp);
                dmp.clear();
                }
            }
        else
            {
            dmp.push_back(ch);
            }
        }
    //Add tail
    if (dmp.size() > 0)
        {
        res.push_back(dmp);
        dmp.clear();
        }

    return res;
}


Generated by  Doxygen 1.6.0   Back to index