iOS Question Textreader / Textwriter replacement

Discussion in 'iOS Questions' started by mrossen, Dec 26, 2014.

Similar threads

B4i Tutorial Files and Folders
B4i Tutorial iBeacons
B4i Code Snippet Monitor http requests progress
B4i Tutorial Notifications with actions
B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For
  1. mrossen

    mrossen Active Member Licensed User


    I am aware of that textreader/textwriter not is avalible in b4i.

    I wonder what it the smartest way to replace it.

    I have replaced it in one of my Projects with "File.WriteList" and it seems to work perfect until I discoveres it only uses UTF8.

    Would it be possible to make something like "File.WriteList2(Dir AsString, FileName AsString, List AsList, CharSet AsString)"

    Or do I have to combine all lines to one string and use:

    [​IMG] WriteString2 (Dir AsString, FileName AsString, Text AsString, CharSet AsString)

    Any suggestions

  2. Erel

    Erel Administrator Staff Member Licensed User

    BTW, why do you need to use a different charset?
    Sub WriteList2(Dir As String, FileName As String, List1 As List, CharSet As String)
    Dim sb As StringBuilder
    For Each line As Object in List1
    File.WriteString(Dir, FileName, sb.ToString, CharSet)
    End Sub
  3. mrossen

    mrossen Active Member Licensed User


    I write a html file, I then send by email and open on a PC. My Danish char is then wrong

    Thanks Erel,

  4. Erel

    Erel Administrator Staff Member Licensed User

    Here is the ReadList2 implementation:
    Sub ReadList2(Dir As String, FileName As String, CharSet As StringAs List
    Dim s As String = File.ReadString2(Dir, FileName, CharSet)
    Dim l1 As List = Regex.Split("[\r\n]+", s)
    Return l1
    End Sub
  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