<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><TITLE>Re: [vrf] quotes comparison - the answer</TITLE><META content="MSHTML 5.50.4937.800" name=GENERATOR></HEAD><BODY><DIV><FONT face=Arial color=#0000ff size=2><DIV><SPAN class=470302618-27042004><FONT face=Arial color=#0000ff size=2>Unfortunately this has solution has a similar problem. Consider when str1="a" and str2="bbb", you get an erroneous zero (-1+-1+3-1). I knew of ways to fix the problem but they were all inelegant so I didn't post anything, luckily Paul Fowler came along with the great solution of using <FONT size=2>abs(strPosStr(str1,str2))+abs(strPosStr(str2,str1)) Hopefully any code that was using the old posted version with the bug in it can be easily updated.</FONT></FONT></SPAN></DIV><DIV><SPAN class=470302618-27042004><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV><DIV><SPAN class=470302618-27042004><FONT face=Arial color=#0000ff size=2>Have a good day,</FONT></SPAN></DIV><DIV><SPAN class=470302618-27042004><FONT face=Arial color=#0000ff size=2>Andy Young</FONT></SPAN></DIV></FONT></DIV><BLOCKQUOTE> <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Keith Piggott [mailto:Keith.Piggott@raymarine.com]<BR><B>Sent:</B> Tuesday, April 27, 2004 8:10 AM<BR><B>To:</B> VRF<BR><B>Subject:</B> [vrf] Re: quotes comparison<BR><BR></FONT></DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2>Andy</FONT></SPAN></DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2></FONT></SPAN> </DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2>You could try adding a third expression to the formula to compare the lengths of each string, strLen(str2)-strLen(str1). </FONT></SPAN></DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2></FONT></SPAN> </DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2>e.g.</FONT></SPAN></DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2> strPosStr(str1,str2)+strPosStr(str2,str1)+(strLen(str2)-strLen(str1))</FONT></SPAN></DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2></FONT></SPAN> </DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2>This detects the prefixed extra character and returns 0 for equivalence. <P><FONT face=Arial><B>Regards,</B> </FONT></P> <P><FONT face=Arial><B>Keith Piggott</B> <BR><B>Test Engineering</B></FONT> </P> <P><FONT face="Arial Black" color=#990033 size=5>Raymarine</FONT> <BR><FONT face=Arial color=#990033> ...world leaders in marine electronics</FONT> <BR><FONT face=Arial><B>Tel : 44 (0)23 9269 3611 (1442) Fax : 44 (0)23 9269 4642</B> <BR><B>e-mail : keith.piggott@raymarine.com </B><BR><B>website:<U> </U><U><FONT color=#0000ff>www.raymarine.com</FONT></U></B></FONT> </P> <P><FONT face=Arial size=1>The information in this e-mail is confidential and is intended solely for the addressee. Access, copying or re-use of information contained in it by anyone else is unauthorised.</FONT></P></FONT></SPAN></DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2></FONT></SPAN> </DIV> <DIV><SPAN class=268294111-27042004><FONT face="Courier New" size=2></FONT></SPAN> </DIV> <BLOCKQUOTE> <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Young, Andrew [mailto:ayoung09@harris.com]<BR><B>Sent:</B> 26 April 2004 23:12<BR><B>To:</B> VRF<BR><B>Cc:</B> 'adam_kohler@agilent.com'<BR><B>Subject:</B> [vrf] Re: quotes comparison - the answer<BR><BR></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=976550122-26042004>Sorry this is a more than a month late but there's a subtle bug here. If one string is the same as the other except for a single character appended at the beginning then the results (1 and -1) sum to 0 also. Try "SCPI" and "aSCPI" in the given example.</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=976550122-26042004></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=976550122-26042004>I hope this helps,</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=976550122-26042004>Andy Young</SPAN></FONT></DIV> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Keith Piggott [mailto:Keith.Piggott@raymarine.com]<BR><B>Sent:</B> Friday, March 19, 2004 7:33 AM<BR><B>To:</B> VRF<BR><B>Subject:</B> [vrf] Re: quotes comparison - the answer<BR><BR></FONT></DIV> <DIV><FONT face=Tahoma size=2><SPAN class=931142712-19032004>Adam</SPAN></FONT></DIV> <DIV><FONT face=Tahoma><SPAN class=931142712-19032004></SPAN></FONT><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004><FONT face="Courier New" color=#0000ff></FONT></SPAN></FONT></FONT> </DIV> <DIV><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004>If you reverse the comparison and add the two together, then result 0 = same, otherwise different.</SPAN></FONT></FONT></DIV> <DIV><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004></SPAN></FONT></FONT> </DIV> <DIV><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004></SPAN></FONT></FONT><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004><B><FONT face=Arial size=1>Regards,</FONT></B> </DIV> <DIV> <P><FONT face=Arial><B>Keith Piggott</B> <BR><B>Test Engineering</B></FONT> </P> <P><FONT face="Arial Black" color=#990033 size=5>Raymarine</FONT> <BR><FONT face=Arial color=#990033 size=2> ...world leaders in marine electronics</FONT> <BR><B><FONT face=Arial size=1>Tel : 44 (0)23 9269 3611 (????) Fax : 44 (0)23 9269 4642</FONT></B> <BR><B><FONT face=Arial size=1>e-mail : keith.piggott@raymarine.com </FONT></B><BR><B><FONT face=Arial size=1>website:<U> </U></FONT><U><FONT face=Arial color=#0000ff size=1>www.raymarine.com</FONT></U></B> </P> <P><FONT face=Arial size=1>The information in this e-mail is confidential and is intended solely for the addressee. Access, copying or re-use of information contained in it by anyone else is unauthorised.</FONT></P></SPAN></FONT></FONT></DIV> <DIV><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004></SPAN></FONT></FONT> </DIV> <DIV><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004></SPAN></FONT></FONT> </DIV> <DIV><FONT face=Tahoma><FONT size=2><SPAN class=931142712-19032004> </SPAN>-----Original Message-----<BR><B>From:</B> KOHLER,ADAM (A-Scotland,ex1) [mailto:adam_kohler@agilent.com]<BR><B>Sent:</B> 19 March 2004 12:13<BR><B>To:</B> VRF<BR><B>Subject:</B> [vrf] Re: quotes comparison - the answer<BR><BR></DIV></FONT></FONT> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <DIV><SPAN class=863170812-19032004><FONT face="Courier New" color=#0000ff size=2>I need to find a way of determining if the strings in two arrays are the same. But it also needs to test each element individually. The attached simple example is almost right but it thinks element two is the same. I don't want to do this with loops.</FONT></SPAN></DIV> <DIV><SPAN class=863170812-19032004><FONT face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV> <DIV><SPAN class=863170812-19032004><FONT face="Courier New" color=#0000ff size=2>Anyone any ideas?</FONT></SPAN></DIV> <DIV><SPAN class=863170812-19032004> <P><FONT size=2>Adam Kohler<BR>Software Test<BR>EPSG<BR>Agilent Technologies<BR>Scotland<BR><BR>tel net 313 5327<BR>t +44 131 335 7327<BR>e adam_kohler@agilent.com </FONT></P></SPAN></DIV></BLOCKQUOTE></BLOCKQUOTE>---<BR>You are currently subscribed to vrf as: Keith.Piggott@raymarine.com<BR>To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".<BR>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing list, email "vrf@agilent.com". <BR>If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com". </BLOCKQUOTE>---<BR>You are currently subscribed to vrf as: ayoung09@harris.com<BR>To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".<BR>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing list, email "vrf@agilent.com". <BR>If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com". </BLOCKQUOTE>---<BR>You are currently subscribed to vrf as: rsb@soco.agilent.com<BR>To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".<BR>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing list, email "vrf@agilent.com". <BR>If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".</BODY></HTML>
The problem arises when you get a 1 + -1 so..
abs(strPosStr(str1,str2))+abs(strPosStr(str2,str1))
......will do the job. 0 is returned on an exact match, another number
otherwise.....
Paul F.
"Keith Piggott" To: VRF <vrf@agilent.com>
<Keith.Piggott@raymar cc:
ine.com> Subject: [vrf] Re: quotes comparison
27/04/04
13:09
Please respond to "Keith
Piggott"
Stationery name:-Untitled-
Andy
You could try adding a third expression to the formula to compare the
lengths of each string, strLen(str2)-strLen(str1).
e.g.
strPosStr(str1,str2)+strPosStr(str2,str1)+(strLen(str2)-strLen(str1))
This detects the prefixed extra character and returns 0 for equivalence.
Regards,
Keith Piggott
Test Engineering
Raymarine
?world leaders in marine electronics
Tel : 44 (0)23 9269 3611 (1442) Fax : 44 (0)23 9269 4642
e-mail : keith.piggott@raymarine.com
website: www.raymarine.com
The information in this e-mail is confidential and is intended solely for
the addressee. Access, copying or re-use of information contained in it by
anyone else is unauthorised.
-----Original Message-----
From: Young, Andrew [mailto:ayoung09@harris.com]
Sent: 26 April 2004 23:12
To: VRF
Cc: 'adam_kohler@agilent.com'
Subject: [vrf] Re: quotes comparison - the answer
Sorry this is a more than a month late but there's a subtle bug here.
If one string is the same as the other except for a single character
appended at the beginning then the results (1 and -1) sum to 0 also.
Try "SCPI" and "aSCPI" in the given example.
I hope this helps,
Andy Young
-----Original Message-----
From: Keith Piggott [mailto:Keith.Piggott@raymarine.com]
Sent: Friday, March 19, 2004 7:33 AM
To: VRF
Subject: [vrf] Re: quotes comparison - the answer
Adam
If you reverse the comparison and add the two together, then
result 0 = same, otherwise different.
Regards,
Keith Piggott
Test Engineering
Raymarine
...world leaders in marine electronics
Tel : 44 (0)23 9269 3611 (????) Fax : 44 (0)23 9269 4642
e-mail : keith.piggott@raymarine.com
website: www.raymarine.com
The information in this e-mail is confidential and is intended
solely for the addressee. Access, copying or re-use of
information contained in it by anyone else is unauthorised.
-----Original Message-----
From: KOHLER,ADAM (A-Scotland,ex1)
[mailto:adam_kohler@agilent.com]
Sent: 19 March 2004 12:13
To: VRF
Subject: [vrf] Re: quotes comparison - the answer
I need to find a way of determining if the strings in two
arrays are the same. But it also needs to test each element
individually. The attached simple example is almost right
but it thinks element two is the same. I don't want to do
this with loops.
Anyone any ideas?
Adam Kohler
Software Test
EPSG
Agilent Technologies
Scotland
tel net 313 5327
t +44 131 335 7327
e adam_kohler@agilent.com
---
You are currently subscribed to vrf as: Keith.Piggott@raymarine.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to
"leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
---
You are currently subscribed to vrf as: Paul.Fowler@raytheon.co.uk
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".