seperating strings

Hi I am nnew to c++ and have a simple question.
say i have a string of str = "hello world 23.133";
I wish to store a string values to
str1 = "hello";
str2 = "world";
double = 23.133;

another one will be to ignore \n
str = "123\n45 foot'\n'ball 5\n67"
str1 = "12345"
str2 = "foot''ball"
double = 567;

another question is if string does not contain
world world double = return false
so for example str = 12345 12345 12345 will be ok
but with str = 12345 12345 hello will return false
thank you~
Use string::find() to find the index of the next space or newline.
Use string::substr() to return a portion of the string.

Topic archived. No new replies allowed.