Android Question Missing ) in BytesToString

Discussion in 'Android Questions' started by Eldritch, Mar 30, 2015.

  1. Eldritch

    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.
     

    Attached Files:

  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Because you set the Sub name to a value

    Return the value, not ReturnSubject = ...

    Code:
    Sub ReturnSubject(SubjectLine As StringAs 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
     
    DonManfred likes this.
  3. Eldritch

    Eldritch Member Licensed User

    Duuuh, stupid me. Writing VBS code and not B4A. Thanks for the help:)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice