.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 4th, 2012, 06:12 PM
aljones aljones is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Location: Terlingua, TX
Posts: 15 aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 50 m 3 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old November 5th, 2012, 06:11 PM
aljones aljones is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Location: Terlingua, TX
Posts: 15 aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level)aljones User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 50 m 3 sec
Reputation Power: 0
Bump??

Reply With Quote
  #3  
Old November 29th, 2012, 09:18 PM
argee argee is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 8 argee User rank is Corporal (100 - 500 Reputation Level)argee User rank is Corporal (100 - 500 Reputation Level)argee User rank is Corporal (100 - 500 Reputation Level)argee User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 h 19 m 29 sec
Reputation Power: 0
I'm not sure if this will help you, but to test out your logic,
I tried using the search part of your code as follows :

Code:
        Dim i As Integer
        Dim strString As String = TextBox1.Text.ToLower

        For i = 0 To ListBox1.Items.Count - 1
            arDesigner(i) = ListBox1.Items(i).ToString
        Next

        For i = UBound(arDesigner) - 1 To 0 Step -1
            If strString Like "*" & arDesigner(i) & "*" Then
                MessageBox.Show(arDesigner(i))
            End If
        Next


And made strString = "(c) daisuke sugisawa001.00" and the following as list items :

DadoQueiroz
Daisuke Monma
daisuke sugisawa
Dale R. Kramer
dale schumacher
Typographer?s Edition (93)
Typographer?s Edition \(93\)
Typographer?s Edition (94)

I only got the one match on item 3.

cheers,

argee

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > I don't "LIKE" this

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap