Separating commands from string?
Posted on 2004-08-24
I wondered if anyone could advise? I am trying to write a command line interface which allows several commands be enter together as a string and we separate these for processing.
The commands are all in uppercase, and can be single or come with a value.
An example input could be COMMAND SECONDCOMMAND:VALUE
The : symbol means a value is attached to this command, I thought perhaps I could use the strtok function to find the : values which would also give the command, here this would give SECONDCOMMAND:VALUE, but I wondered how I could locate the single commands?
I also thought I could create an object for each command, and it value such as:
I would be appreicate some guidance, should I perhaps be trying not use existing tools. And loop through the string line searching for uppercase letters?