Jump to content
Sign in to follow this  
AzKay

Anyone have a StringSplit() function for C?

Recommended Posts

AzKay

in C++; I used;

vector <string> split(string line, string delims){
    string::size_type bi, ei;
    vector<string> words;

    bi = line.find_first_not_of(delims);
    while(bi != string::npos){
        ei = line.find_first_of(delims, bi);
        if(ei == string::npos)
            ei = line.length();
        words.push_back(line.substr(bi, ei-bi));
        bi = line.find_first_not_of(delims, ei);
    }
    return words;
}

Though, doesnt seem to be backwards compatible.

So, ive been googling but havnt came up with anything.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
Bowmore

Have a look at strtok and wcstok


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×