Skip to content

Commit

Permalink
Fix issue #70
Browse files Browse the repository at this point in the history
Fix issue #70. When certain characters were the first character in a line on a pocket label, the application would generate an exception. Appears to be an issue with the .indexOf function. If the .indexOf function returns a value less than 0, try the InStr function instead and adjust the offset into the string appropriately.
  • Loading branch information
mgobat committed Aug 23, 2024
1 parent 1e8edac commit b77a76f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
24 changes: 19 additions & 5 deletions Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Public Class Form1
'v. 2.3: dlgSettings.UseEXDialog = True to enable print dialog selection in Windows 7
'v. 2.2: corrects spacing & punctuation errors in incoming call numbers (for TML);
'v. ...:
Dim somVersion As String = "8.1.2"
Dim somVersion As String = "8.1.3"
Dim javaClassName As String = "almalabelu2" 'the java class name
Dim javaSDKName As String = "alma-sdk.1.0.jar" 'the Ex Libris SDK for web services
Dim javaTest As String = "javatest" 'java class that reports presence and version of java
Expand Down Expand Up @@ -1119,10 +1119,24 @@ Public Class Form1
Dim s As String = ""
plOutput.Text = ""
For k = 0 To line.Length - 1
If line(k).contains(vbTab) Then
plOutput.Text = plOutput.Text & line(k).substring(line(k).indexOf(vbTab) + 1) & vbCrLf
line(k) = line(k).substring(0, line(k).indexOf(vbTab))
Else
If line(k).contains(vbTab) Then
'The two lines of code commented out below were replaced with monstrousity below it (up to the "Else") to fix GitHub issue #70.
'For some reason, a leading unicode character was causing a problem with the .indexOf function.
'plOutput.Text = plOutput.Text & line(k).substring(line(k).indexOf(vbTab) + 1) & vbCrLf
'line(k) = line(k).substring(0, line(k).indexOf(vbTab))
Dim iTabLoc = line(k).indexOf(vbTab)
If iTabLoc < 0 Then
iTabLoc = InStr(line(k), vbTab)
Else
iTabLoc = iTabLoc + 1
End If
plOutput.Text = plOutput.Text & line(k).substring(iTabLoc) & vbCrLf
iTabLoc = line(k).indexOf(vbTab)
If iTabLoc < 0 Then
iTabLoc = InStr(line(k), vbTab)
End If
line(k) = line(k).substring(0, iTabLoc)
Else
plOutput.Text = plOutput.Text & line(k)
End If
Next
Expand Down
4 changes: 2 additions & 2 deletions My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly:AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("8.1.2.0")>
<Assembly: AssemblyFileVersion("8.1.2.0")>
<Assembly: AssemblyVersion("8.1.3.0")>
<Assembly: AssemblyFileVersion("8.1.3.0")>

0 comments on commit b77a76f

Please sign in to comment.