Android Question Problem on text.lenght with 2 same text

Discussion in 'Android Questions' started by ArminKH, Apr 3, 2015.

  1. ArminKH

    ArminKH Well-Known Member

    hi all
    This is so wonderfull
    i have a text file(written by notepad) with 1 simple string like "ArminKH"
    by using text reader i read my string from text file but today when i log my text.lenght i see wrong result
    when i copy my text from log to one line of b4a i see different font for my text but i never change any fonts
    please let me to know what is wrong on this simple thing or maybe i am on sleep
    please see attached sample code + screen shot + text file
     

    Attached Files:

    Last edited: Apr 4, 2015
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    Hmm strange, 2 different font types (type face). I had big issues with your first log line but your second line worked perfect. Even using the cursor to scroll along the first log line caused issues. Even when I go to Tools > IDE Options > Change Font, and I change the fonts, font style and font size I still had issues with your first log file. Writing the line out manually works perfectly fine though :confused:
     
    Last edited: Apr 4, 2015
    ArminKH likes this.
  3. ArminKH

    ArminKH Well-Known Member

    @Peter Simpson
    So why this happen? This is unlucky effect of my name into strings? :D
     
  4. ArminKH

    ArminKH Well-Known Member

    @Erel
    Excuse me 4 mention u but i think this question just can be answered by u :(
     
  5. stevel05

    stevel05 Expert Licensed User

    Look at the B4a file using a Hex editor, the text you have pasted has 3 extra values (hex ef,bb and bf) which are presumably changing the displayed font, and causing the string size error.
     
    ArminKH likes this.
  6. ArminKH

    ArminKH Well-Known Member

    thank u
    And what is the solution? Write text file just by using b4a text writer?
     
  7. stevel05

    stevel05 Expert Licensed User

    That may not always be feasible if you need to use third party text files, and it depends on the required use of the file. If you only want a plain text file you could check the Ascii range of it's content and remove unwanted characters. You could duplicate the file first if you want to keep the original intact.
     
    ArminKH likes this.
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