I have this function but it needs a slight amendment.
It fails on these strings:
strcurin= "a3 110"
cur in=A3 S LINE BLACK EDITION (138)
testfield=A3 S LINE BLACK EDITION
each of the five words appears in cur
this one will fail
cur=A3 S LINE BLACK EDITION QUATTRO (170
testfield=A3 S LINE BLACK EDITION QUATTRO (
the first 6 words are in but the seventh word"(" is not a word in cur, it is a substring of (170" but i dont want that comparison.
it should pass as a3 in test field is a word in curin
I remmed out the piece that tests elements on both sides are there as the strtestfieldin could have or be equal too the elements of strcurin.
so cur will never be less than the test string
here i want to test if a3 exists as a word in strtestfieldin but not as an instring word for word.
the test fields are having things extracted from them. the remaining words should appear in cur somewhere, unless an extraction routine left a part word.
Function word4wordCheck(StrCURIn As String, StrTESTFieldin As String) As Boolean
' Dim ExtractWordsPhrase1() As String
' Dim ExtractWordsPhrase2() As String
' Dim WordCountPhrase1, WordCountPhrase2 As Integer
' Dim intLoop As Integer
' ExtractWordsPhrase1 = Split(Trim(StrCURIn), " ")
' ExtractWordsPhrase2 = Split(Trim(StrTESTFieldin), " ")
'' 'If element count of arrays differ return false
'' If UBound(ExtractWordsPhrase1) <> UBound(ExtractWordsPhrase2) Then
'' word4wordCheck = False
'' Exit Function
'' End If
' 'Check each element of Array
' For intLoop = LBound(ExtractWordsPhrase1) To UBound(ExtractWordsPhrase1)
' If ExtractWordsPhrase1(intLoop) <> ExtractWordsPhrase2(intLoop) Then
' word4wordCheck = False
' Exit Function
' End If
' word4wordCheck = True