c++ - istream parse EVENT_TYPE(param1;param2; ...) -


i'm trying find elegant way parse string like:

event_type(param1;param2; ...) 

event_type 1 of many string constants, each has 0 or more parameters. far thought given sting "s" contains event_type(param1;param2) i'd write:

if (boost::istarts_with(s, "event_type")) {   std::istringstream iss(s);   int param1, param2;   iss >> "event_type(" >> param1 >> ";" >> param2 >> ")"; } 

that nice give const string& , tell way "skip these characters". well, that's not case. how there go this? :-)

thanks advice!

this looks complicated enough warrant "real" parser. since you're using boost, try first: http://boost-spirit.com/home/


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -