Android Question Missing ) in BytesToString

Eldritch

Member
Licensed User
Longtime User
Hi All

I'm going crazy over this. I have modified Erels mailparser and now I get an error where no error should be.

Error description: ')' expected.
Occurred on line: 158
ReturnSubject = BytesToString(bytes, 0, bytes.Length, "utf-8")
Word: )

The ')' is there, but still i fails.

Any Body who can se where I error??


I'm using V. 3.8 of b4a.
 

Attachments

  • testbas.zip
    12.4 KB · Views: 259

thedesolatesoul

Expert
Licensed User
Longtime User
Because you set the Sub name to a value

Return the value, not ReturnSubject = ...

B4X:
Sub ReturnSubject(SubjectLine As String) As String
    Dim tmpString As String
    tmpString=SubjectLine.ToLowerCase
    If tmpString.Contains("utf-8?b?") Then
        tmpString=SubjectLine.SubString(SubjectLine.IndexOf("B?") + 2)
        tmpString=tmpString.SubString2(0,tmpString.IndexOf("?="))

        Dim su As StringUtils
        Dim bytes() As Byte = su.DecodeBase64(tmpString)
       
        Return BytesToString(bytes, 0, bytes.Length, "utf-8")

    Else
        Return SubjectLine.SubString(SubjectLine.IndexOf(":") + 1)
    End If

End Sub

Return BytesToString(bytes, 0, bytes.Length, "utf-8") not ReturnSubject = BytesToString(bytes, 0, bytes.Length, "utf-8") when ReturnSubject is also your sub name
 
Upvote 0
Top