RE: String Comparison

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Purnima (Purnima_at_discussions.microsoft.com)
Date: 03/08/05


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?



Relevant Pages

  • Re: Split function or Join function: delimiter problem
    ... I definitely understand how this works, but how do I give a value to OldLine in the first place? ... "Rick Rothstein" wrote: ... each one needs parameters to put around string expressions. ...
    (microsoft.public.vb.general.discussion)
  • Re: print string with * character
    ... > i have a string which contains the * character. ... > this expression is a wildcard character using the print statement (i ... > suppressing the ksh use of wildcards in string expressions or similar ...
    (comp.unix.shell)
  • Re: Shed my a light :)
    ... TheSaint wrote: ... for routines in actions: ... I'd like to note that actions are string or string expressions of the ...
    (comp.lang.python)
  • RE: String Comparison
    ... You might consider dropping the last word from each string before comparing ... Function Compare(ByVal String1 As String, ByVal String2 As String) As Boolean ... End Sub ... > I want to perform a comparison on two string expressions. ...
    (microsoft.public.excel.programming)
  • Project Error
    ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
    (microsoft.public.vb.bugs)