RE: String Comparison
From: Purnima (Purnima_at_discussions.microsoft.com)
Date: 03/08/05
- Next message: Bob Phillips: "Re: On Close macro"
- Previous message: Patrick Molloy: "Re: How to query Excel Data Using SQL?"
- In reply to: AA2e72E: "RE: String Comparison"
- Next in thread: AA2e72E: "RE: String Comparison"
- Reply: AA2e72E: "RE: String Comparison"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Mar 2005 01:25:02 -0800
Hi..
I cannot drop the last word from the comparison. I wish to compare the whole
string
including the last words of both string expressions. The result should be as
follows:
String1 String2
Result
1. ABC Systems Limited ABC Systems Ltd
TRUE
2. ABC Systems Limited ABC Systems Inc.
FALSE
So I need to check whether the last word in one of the string expr. is an
abbreviation of the last word in the other string expr. If it is, then return
true, but if it is a totally different abbr. then return false.
"AA2e72E" wrote:
> You might consider dropping the last word from each string before comparing
> them:
>
> Function Compare(ByVal String1 As String, ByVal String2 As String) As Boolean
> Compare = UCase(Left(String1, InStrRev(String1, " "))) =
> UCase(Left(String2, InStrRev(String2, " ")))
> End Function
>
> Sub xx()
> Debug.Print Compare("ABC SYSTEMS LTD", "abc Systems limited")
> End Sub
>
> "Purnima" wrote:
>
> > Hi...
> > I want to perform a comparison on two string expressions. The strings would
> > normally be of the form "ABC Systems Limited" or "ABC Systems LTD". Now if I
> > were to compare these two strings, I want the macro to return true even if
> > the last part of the strings dont match exactly, i.e. Limited and LTD. In
> > simpler words, it should return true for two strings expressions containing
> > abbreviations like LTD( Limited), Hlgds( Holdings) etc. Can anyone please
> > help me with this?
- Next message: Bob Phillips: "Re: On Close macro"
- Previous message: Patrick Molloy: "Re: How to query Excel Data Using SQL?"
- In reply to: AA2e72E: "RE: String Comparison"
- Next in thread: AA2e72E: "RE: String Comparison"
- Reply: AA2e72E: "RE: String Comparison"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|