Why doesn't this fuzzy search in vb6 work? How can I change this to make it work?

Why doesn't this fuzzy search in vb6 work?  How can I change this to make it work?

If "cerebral" Like "*cere" Then
MsgBox "these are the same"
End If
blackbookcoder2Asked:
Who is Participating?
 
PaulHewsCommented:
The wildcard * is a stand in for other characters... in this case, any other characters.  These would be true:

Private Sub Command1_Click()

    If "cerebral dancing monkey" Like "cere*" Then
        MsgBox "alike"
    End If
        If "cerebral" Like "cere*" Then
        MsgBox "alike"
    End If

    If "cereal" Like "cere*" Then
        MsgBox "alike"
    End If

End Sub


Putting the * at the beginning of the string would match any character at the beginning of the string.  For example:

If "This is a test" Like "*a test" Then
  Msgbox "alike"
End If



But an asterix at the beginning cannot match characters at the end of the string as in your example...
0
 
blackbookcoder2Author Commented:
PaulHews, thanks for your help.  Sincerely, blackbookcoder2
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.