Removed #5 Posted November 5, 2012 Report Share Posted November 5, 2012 Do we have any here? I have a program I've been working on that has just decided it wants to help drive me crazy! If we do, I'll drop a bit of code on you and ask from some suggestions. Quote Link to comment Share on other sites More sharing options...
Sparks Posted November 5, 2012 Report Share Posted November 5, 2012 [MENTION=1]Marc[/MENTION] you have right? I've done a little bit, but I'm not a huge fan lol Sent from my GT-I9100 using Xparent Cyan Tapatalk 2 Quote Link to comment Share on other sites More sharing options...
BlueWolf Posted November 5, 2012 Report Share Posted November 5, 2012 I've done Visual Basic 6 and when I look back at it, it was absolute hell Is the problem VB specific? I've debugged C++ before and that's while I've never seen the language before Quote Link to comment Share on other sites More sharing options...
Removed #5 Posted November 5, 2012 Author Report Share Posted November 5, 2012 (edited) This was fairly straight forward. I've pulled the text data from a font file, and in this routine am searching backwards through an array of designer names looking for a hit on the designer. strString contains the concatenated text from the font file. 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 = "© daisuke sugisawa001.00'" The array I'm parsing through, in part, looks like: Quote: [TABLE] [TD="class: alt2"] DadoQueiroz Dado Queiroz Daisuke Monma Daisuke Monma daisuke sugisawa Daisuke Sugisawa Dale R. Kramer Dale R Kramer dale schumacher Dale Schumacher[/TD] [/TABLE] 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: [TABLE] [TD="class: alt2"] Typographer?s Edition (93) Typographers Edition (93) Typographer?s Edition \(93\) Typographers Edition (93) Typographer?s Edition (94) Typographers Edition (94)[/TD] [/TABLE] Like is returning true ( a match ) on the last line ... and I can't see why. Looking at the other files where I've not had a valid hit it appears as if the paranthesis might be the proble but a paranthesis is a match character to the like operator. Anyone? By the way, the reason for the backward search is to allow those cases where a name is contained within another name to get hit first. "Paul Roberts" needs to come after "Paul Robertson" (logically) for example - solved easiest by an alphabetical sort and a reverse search. Edited November 5, 2012 by Al Jones Quote Link to comment Share on other sites More sharing options...
Marc Posted November 5, 2012 Report Share Posted November 5, 2012 This was fairly straight forward. I've pulled the text data from a font file, and in this routine am searching backwards through an array of designer names looking for a hit on the designer. strString contains the concatenated text from the font file. 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 [/CODE] 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 = "© daisuke sugisawa001.00'" The array I'm parsing through, in part, looks like: Quote: [TABLE] [TD="class: alt2"] DadoQueiroz Dado Queiroz Daisuke Monma Daisuke Monma [i]daisuke sugisawa[/i] Daisuke Sugisawa Dale R. Kramer Dale R Kramer dale schumacher Dale Schumacher[/TD] [/TABLE] 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: [TABLE] [TD="class: alt2"] Typographer?s Edition (93) Typographers Edition (93) Typographer?s Edition \(93\) Typographers Edition (93) Typographer?s Edition (94) Typographers Edition (94)[/TD] [/TABLE] Like is returning true ( a match ) on the last line ... and I can't see why. Looking at the other files where I've not had a valid hit it appears as if the paranthesis might be the proble but a paranthesis is a match character to the like operator. Anyone? By the way, the reason for the backward search is to allow those cases where a name is contained within another name to get hit first. "Paul Roberts" needs to come after "Paul Robertson" (logically) for example - solved easiest by an alphabetical sort and a reverse search. [hr][/hr] debuggin brb Quote Link to comment Share on other sites More sharing options...
Marc Posted November 5, 2012 Report Share Posted November 5, 2012 what is arDesigner? Quote Link to comment Share on other sites More sharing options...
Marc Posted November 5, 2012 Report Share Posted November 5, 2012 oh bein dumb ... it the array Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.