iOS Question Textreader / Textwriter replacement

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

  1. mrossen

    mrossen Active Member Licensed User

    Hi,

    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

    Mogens
     
  2. Erel

    Erel Administrator Staff Member Licensed User

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

    mrossen Active Member Licensed User

    Hi,.

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

    Thanks Erel,

    Mogens
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Here is the ReadList2 implementation:
    Code:
    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
     
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