Comparing two strings
Posted on 2004-11-09
Okay, I have looked and looked and can't find what I am looking for. I have a program that compares a webpage every week. It strips down the tags and gets the barebone text of the page and should compare it to the previous week. Before I had it compare each letter from the start until something change and then went in reverse until it changed and showed me that block of text in red. Problem was it would not give me true results. If one word was change at the beginning and one and the end it would have a huge block of text when it might be just two words. I am looking for something that would just return those two words in there location and nothing else.
String1 = "I am looking to compare two text files and return the results."
String2 = "I am trying to compare text files and return the results."
Results = "looking two"
Before it would return: "looking to compare t"
Obviously totally different. Let me know if you have any questions. Any help to get on the right track would be appreciated. Thanks.