Android Question How to remove ASCII65279 from string

Discussion in 'Android Questions' started by Roger Daley, Aug 19, 2015.

  1. Roger Daley

    Roger Daley Well-Known Member Licensed User

    Hi All,

    Without distracting you with the in's and out's, my program reads a line of text from a file that can be edited by the user. If the user uses notepad or notepad++ ASCII65279 [Non printable char] can be added to the start of the line. As I do a "string" comparison this extra char throws everything out of wack.

    The question is, once I have read the line of text how do I remove ASCII65279?
    I have tried Riedlyne
    Riedlyne = Riedlyne.Replace(Asc(65279),"")
    without success.
    I could test with something like
    if (Asc(Riedlyne.CharAt(0))) = 65279 then DoSomething
    to produce alternative string comparisons but that is messy.

    Regards Roger
  2. DonManfred

    DonManfred Expert Licensed User

    I suggest to save the file without BOM in your texteditor (see options).
    Maybe upload such a text file so we can have a look
  3. Roger Daley

    Roger Daley Well-Known Member Licensed User

    Thanks DonManfred but unfortunately the user gets to edit the text file. I can only have the program deal with the problem if it happens

  4. stevel05

    stevel05 Expert Licensed User

    Then Try
    Riedlyne = Riedlyne.Replace(Chr(65279),"")
    Erel and Roger Daley like this.
  5. Roger Daley

    Roger Daley Well-Known Member Licensed User

    Thanks stevel05,

    Worked perfectly. Like many things, it's obvious we someone else points you in the right direction.:rolleyes:

    Regards Roger
  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