Public Function func_Comparetwoarrays(aFirstArray,aSecondArray)
Dim intRowVal ' Incrementer
Dim StrInputVal ' Capture input Array details
Dim strFailureVal 'To capture failed array values.
Dim strCapturedVal 'to store captured values.
'verify whether input arrays are empty or not.
If UBound(aFirstArray) <> -1 And UBound(aSecondArray) <> -1 Then
'verify whether input arrays sizes are equal or not.
If UBound(aFirstArray) = UBound(aSecondArray) Then
'repeat loop untill last element in each array is verified.
For intRowVal = 0 To UBound(aFirstArray)
'converting each charated in text in to upper case.
firstarrval = Ucase(Trim(aFirstArray(intRowVal)))
secondarrval = Ucase(Trim(aSecondArray(intRowVal)))
'removing spaces between the words in the text.
firstarrval = Replace(firstarrval," ","")
secondarrval = Replace(secondarrval," ","")
If Trim(firstarrval)<> "" and Trim(secondarrval)<>""Then
' Compares the input array values with captured array values
If Instr(Trim(firstarrval),Trim(secondarrval)) > 0 or Instr(Trim(secondarrval),Trim(firstarrval)) > 0 Then
func_Comparetwoarrays = True
Else
'captures the array values which are not matched.
func_Comparetwoarrays = aFirstArray(intRowVal)&" , "&aSecondArray(intRowVal)
Exit Function
End If
End If
Next
Else
func_Comparetwoarrays = "Two arrays are different in size."
End If
Else
func_Comparetwoarrays = "Input parameters are not Valid."
End If
End Function ' End of 'Comparetwoarrays' function