How to extract two strings difference
-
OK, I can RTFM but there are way too many options.
I am asking if somebody in this forum "been there, done that " - preferably in C/C++.I am NOT looking for comparing strings - I need to extract the actual difference between them .
How about "finding sub-string in string " and return what is left over or use regular expression.
Would iterating thru both strings and returning "no match" work?
I am asking for ideas -
std::string::find()
std::string::erase() -
What constitutes a difference in your case? What result would you expect when comparing "Hello world" with "The answer is 42"? Do you mean compare on word or letter basis? Is whitespace important? What about strings of different lengths? Do you want a list of different strings or offsets into either of the string as a result?
You need to be a lot more specific for any useful suggestions. A real life example with input strings and expected result would be best.
-
std::string::find()
std::string::erase()@Kent-Dorfman Brilliant , simply brilliant. Thanks