Hello
I have a char variable with lets say: It's:a:test
Now I want to cut this char into parts by specifying the character where to cut, in this case it is the ":".
Thx for help :)
Printable View
Hello
I have a char variable with lets say: It's:a:test
Now I want to cut this char into parts by specifying the character where to cut, in this case it is the ":".
Thx for help :)
You mean you have a string "a:text" and you want to search it for a specific character? if you use std::string then use its find() method. If the string is char* then use strchr() function. Another way is to create a loop that checks each character of the string.
In C there's a function for tokenizing strings, called strtok, but it has got some shortcomings.
http://www.cppreference.com/stdstring/strtok.html
thx the strchr() function does the work :)
yes i have always got a kick out of the man page for strtokQuote:
Originally Posted by joni
quote-- "Never use these functions."