I want to use string Tokenizer for CPP string but all I could find was for Char*.
Is there anything similar for CPP string?
I want to use string Tokenizer for CPP string but all I could find
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you mean by “token”? If it’s something separated by any whitespace, the string streams is what you want:
Alternatively, if your looking for a a certain single separating character, you can replace
iss>>tokenwithstd::getline(iss,token,sep_char).If it’s more than one character that can act as a separator (and if it’s not whitespaces), a combinations of
std::string::find_first()andstd::string::substr()should do.