Android Question Missing ) in BytesToString

Similar threads

B4A Library B4XEncryption
B4A Tutorial [B4X] AsyncStreams Tutorial
B4A Code Snippet [B4X] Join arrays of bytes
B4A Tutorial [B4X] Text, Strings and Parsers
B4A Code Snippet Parsing your apps logs
B4A Code Snippet [B4X] Bytes To File

Eldritch

Member
Licensed 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

thedesolatesoul

Expert
Licensed 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
 
Top