10-12-2011 04:44 AM
hello all,
I need to compare two strings and mark the differences like the attachment. Str 1 maybe not as long as str 2.
Any suggestion?
Thanks.
10-12-2011 04:53 AM
Post the vi you have done so far. We will correct your mistakes if any and provide you the right path so that you can do it your way and will learn much faster.
Mathan 🙂
10-12-2011 06:35 AM
Hi,
I have attached a VI which might solve your purpose.
Regards,
Gopal
10-12-2011 09:27 AM
10-12-2011 10:07 AM
This problem is not well defined.
You said the strings can be of different lenghts, in that case are all the extra characters appended at the end as in the front panel picture you attached? Then, the first five lines are of the same lenght and the differences are one character replaced by another one (in line 1 the 7 was replaced by the letter "a", line 2 the 9 was replaced by the letter "u"). Again is it always the case?
If not there can be a lot of possibilities and this problem can become very complex, you need to put some boundaries somewhere.
Ben64
10-12-2011 09:21 PM
ben64 已写:
This problem is not well defined.
You said the strings can be of different lenghts, in that case are all the extra characters appended at the end as in the front panel picture you attached? Then, the first five lines are of the same lenght and the differences are one character replaced by another one (in line 1 the 7 was replaced by the letter "a", line 2 the 9 was replaced by the letter "u"). Again is it always the case?
If not there can be a lot of possibilities and this problem can become very complex, you need to put some boundaries somewhere.
Ben64
yea, maybe a lot of possibilities and very complex.
In my case, str 1 & str 2 come from windows command line -- FC(file compare). FC gives differences between two similar test logs.
I will try to:
1. compare the line number of two strings, and find the extra lines of str 2(more lines).
2. delete extra lines from str 2, result in str 3.
3. compare str 3 to str 1 as Gopal's Spot Difference.vi.
I will post the solution later.
Many thanks to ben64, Gopal & all.
10-13-2011 03:38 AM
If some lines are similar,it is too complex to sync the lines. It is not a complete solotion. But it solves my problems.
see attachment below.