
November 4th, 2012, 06:12 PM
|
|
Registered User
|
|
Join Date: Sep 2012
Location: Terlingua, TX
|
|
|
I don't "LIKE" this
Okay, bad title but the subject is the Like operator in VB.
Code:
Function SearchDesigner(ByVal strString As String) As String
'Dim errMsg As String
Dim i As Integer
Dim strstrString As String = strString.ToLower
If Len(strString) = 0 Then Return ""
For i = UBound(arDesigner) - 1 To 0 Step -1
Try
If strstrString Like "*" & arDesigner(i, 0) & "*" Then
arDesignerCounter(i) += 1
Return arDesigner(i, 1)
End If
Catch e As ArgumentException
'errMsg = String.Format("Line {0} {1} " & vbLf & "Contains an invalid pattern and will be skipped.", i, arDesigner(i, 0))
'MessageBox.Show(errMsg, "Pattern Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
Next
Return ""
End Function
I've just parsed my way through 225,000 font files. Most of the time this works as I expect but upon occasion (1,500 more or less out of the 225,000 files) it doesn't.
For example: strString = "(c) daisuke sugisawa001.00'"
The array I'm parsing through, in part, looks like:
Quote: DadoQueiroz Dado Queiroz
Daisuke Monma Daisuke Monma
daisuke sugisawa Daisuke Sugisawa
Dale R. Kramer Dale R Kramer
dale schumacher Dale Schumacher |
It should have been true only on the middle line, since nothing that I can see matches til that point.
and the last three lines of the array look like:
Quote: Typographer?s Edition (93) Typographers Edition (93)
Typographer?s Edition \(93\) Typographers Edition (93)
Typographer?s Edition (94) Typographers Edition (94) |
Like is returning true ( a match ) on the last line ... and I can't see why. Anyone?
|