Click here to Skip to main content
15,936,975 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello.
How to parsing a string as str?
C++
stringstream strs;
strs<<"U@1"<<"Vec@(2,4)";
string str = strs.str();
/*
* How to parsing the str ?
*/

Thanks for answering to my question.
Posted
Comments
Richard MacCutchan 25-Feb-12 6:51am    
Parsing for what?
smss IR 25-Feb-12 6:59am    
for discern parameters.
On String exist many parameters such as Number(Player number on footbal [robocup]),Vector(Vector of target to going that).
I want to discern parameters for doing actions on WrightEagleBASE for robocup soccer simulation ( www.wrighteagle.org/2d ).
for example, if string have "U@1V@(2,4)" then Player Number one , move to Point (2,4)
Richard MacCutchan 25-Feb-12 7:10am    
You can use one of the string member functions to find the specific items within the string.
smss IR 25-Feb-12 7:58am    
how can?
Richard MacCutchan 25-Feb-12 8:03am    
By writing some code. I suggest you follow the link I provided and decide which member functions you need to use to get the results you want.

1 solution

u will get the char* using function string::c_str(), which can be used with sscanf function for easy parsing..

Hopes this helps somewhat..
jkchan
http://cgmath.blogspot.com[^]
 
Share this answer
 
Comments
[no name] 25-Feb-12 17:54pm    
But your profile says that you are from the United States. :)
jk chan 26-Feb-12 7:36am    
i was lazy.
smss IR 26-Feb-12 8:04am    
I quote from my friend :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900