I want to compare two string ignoring real time factors like date and time which can be in any locale.
Consider following example.
string str1= “ACV INDIA LIBRARY ABC.APPLE PATH=”G\XXXX….\INDIA\ABC.EFG” <> 03/06/2011 9:24:00 AM”
string str2= “ACV INDIA LIBRARY ABC.APPLE PATH=”G\XXXX….\INDIA\ABC.EFG” <> 03/07/2011 9:24:00 AM”
Note: Position of date and time is not fixed.
result of comparison should return as true
Thanks,
Amit
I want to compare two string ignoring real time factors like date and time
Share
Surely your date/times follow some standard that you have knowledge of. Use a regular expression to match the date/times, remove them, and do a standard string comparison on the resulting strings.
If you want your program to be powerful enough to recognize different formats of dates, then you’ll have to do the work of setting it up to recognize them. Run it through a different regexp for every kind of date/time format you can think of (and are willing to accept). Date/time strings are completely matchable by regular expressions; they are the optimal solution.