Hey Guys,
I'm using the mail parser module to try and download an attachment from some emails I have. I'm getting an index out of bounds error, though.
At this point, the index is returning a -1 as it can't locate the boundary. This causes an error when the code reaches
Does anyone have any suggestions?
I'm using the mail parser module to try and download an attachment from some emails I have. I'm getting an index out of bounds error, though.
B4X:
index = Mail.IndexOf2("--" & boundary, index)
At this point, the index is returning a -1 as it can't locate the boundary. This causes an error when the code reaches
B4X:
Sub ReadNextLine (Mail As String)
Dim sb As StringBuilder
sb.Initialize
Dim c As Char
Do While index < Mail.Length
c = Mail.CharAt(index)
index = index + 1
If c = Chr(13) OR c = Chr(10) Then
If c = Chr(13) AND index < Mail.Length AND Mail.CharAt(index) = Chr(10) Then
index = index + 1
End If
Exit 'break the loop
End If
sb.Append(c)
Loop
Return sb.ToString
End Sub
Does anyone have any suggestions?