Possible Duplicate:
How do I tokenize a string in C++?
I have a string of the following form , which is a user input.
a1 10.2 lib_t 50 sv 60 out 'true'
Here, a1
is a parameter of type double
, and its value is 10.2
. Similarly, lib_t
= 50
, sv
= 60
and out
= 'true'
is a string.
This input can be specified in any order.. such as lib_t 50 a1 10.2
The spaces in between the words may vary.
Edit: Boost tokenizer can handle this. I have written the necessary code. But I want to see if there is any other standard way to handle this WITHOUT using boost library.
The input is pretty short. I am not very keen on the efficiency here (sorry for using the word 'efficient' in my original edit).
any other efficient way
? What efficiency are you looking for? Write the code which first works, then think about efficiency and all!