Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.



Public Function boolMaskCompare(strMask As String, strCandidate As String) As Boolean
boolMaskCompare = (strCandidate Like strMask)
'Sub TESTboolMaskCompare()
'MsgBox boolMaskCompare("abc", "abc") ' TRUE: regular comparison two equal strings.
'MsgBox boolMaskCompare("ab", "abc") ' TRUE: first string is shorter
'MsgBox boolMaskCompare("abc", "ab") ' FALSE: second string is shorter
'MsgBox boolMaskCompare("abc", "abd") ' FALSE: mismatch in last character
'MsgBox boolMaskCompare("abc", "dbc") ' FALSE: mismatch in first character
'MsgBox boolMaskCompare("abcd", "abc") ' FALSE: first string is longer
'MsgBox boolMaskCompare("abc", "abcd") ' TRUE: second string is longer
'MsgBox boolMaskCompare("xabcz", "abc") ' FALSE: first string is buried
'MsgBox OldboolMaskCompare("abc", "xabcz") ' FALSE: second string is buried ???????????
'MsgBox boolMaskCompare("a?c", "abc") ' TRUE: match in a single wildcard character
'MsgBox boolMaskCompare("a*c", "abc") ' TRUE: match in a single wildcard character
'MsgBox boolMaskCompare("a*c", "ac") ' TRUE: none, one or many of the *
'MsgBox boolMaskCompare("a**c", "a*c") ' TRUE: use * as an escape character
'MsgBox boolMaskCompare("a*c", "a**c") ' TRUE:  use * as an escape character
'MsgBox boolMaskCompare("ever", "there was never a man!") ' FALSE : regular comparison two unequal strings. ???????????
'MsgBox boolMaskCompare("*ever*ever*", "if ever there was never a man!") ' TRUE: double wildcard sequence
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1

Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.

Public Function boolMaskCompare(strMask As String, strCandidate As String) As Boolean
boolMaskCompare = (strCandidate Like strMask)
'Sub TESTboolMaskCompare()
'MsgBox boolMaskCompare("abc", "abc") ' TRUE: regular comparison two equal strings.
'MsgBox boolMaskCompare("ab", "abc") ' TRUE: first string is shorter
'MsgBox boolMaskCompare("abc", "ab") ' FALSE: second string is shorter
'MsgBox boolMaskCompare("abc", "abd") ' FALSE: mismatch in last character
'MsgBox boolMaskCompare("abc", "dbc") ' FALSE: mismatch in first character
'MsgBox boolMaskCompare("abcd", "abc") ' FALSE: first string is longer
'MsgBox boolMaskCompare("abc", "abcd") ' TRUE: second string is longer
'MsgBox boolMaskCompare("xabcz", "abc") ' FALSE: first string is buried
'MsgBox OldboolMaskCompare("abc", "xabcz") ' FALSE: second string is buried ???????????
'MsgBox boolMaskCompare("a?c", "abc") ' TRUE: match in a single wildcard character
'MsgBox boolMaskCompare("a*c", "abc") ' TRUE: match in a single wildcard character
'MsgBox boolMaskCompare("a*c", "ac") ' TRUE: none, one or many of the *
'MsgBox boolMaskCompare("a**c", "a*c") ' TRUE: use * as an escape character
'MsgBox boolMaskCompare("a*c", "a**c") ' TRUE:  use * as an escape character
'MsgBox boolMaskCompare("ever", "there was never a man!") ' FALSE : regular comparison two unequal strings. ???????????
'MsgBox boolMaskCompare("*ever*ever*", "if ever there was never a man!") ' TRUE: double wildcard sequence
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1