Please see my comment to the question: it is not fully formulated. However, for a wide class of problems,
Regular Expressions can provide a comprehensive solution. Please see:
http://en.wikipedia.org/wiki/Regular_expression[
^],
http://www.regular-expressions.info/reference.html/[
^],
http://www.regular-expressions.info/refadv.html[
^],
http://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Regular_expression[
^].
You can always find a suitable Regular Expression Engine. Please see:
http://code.google.com/p/regen/[
^],
http://www.drdobbs.com/cpp/regular-expressions-in-c/184404797[
^],
http://freecode.com/projects/cpp_regex[
^].
To find more, try this:
http://bit.ly/NqDGfC[
^].
[EDIT #1]
When you have an engine, using it for complex problems can be a whole art. Look for Expresso. This is a tool which is very helpful:
http://www.ultrapico.com/Expresso.htm[
^].
[EDIT #2]
Expresso also has a very good manual on using Regular Expressions.
[EDIT #3]
Please see also this CodeProject article:
Using Regular Expressions in MFC[
^].
[EDIT #4]
As pastopristi correctly noted below, it could be even as simple as '==' operator of
std::string
… :-)
The problem is that the problem is not strictly formulated. :-(
—SA