B4J Question File.ReadList's line terminator?

Bruce Axtens

Active Member
Licensed User
Longtime User
What is the terminator of a line when ReadList is used? CRLF, LF or CR? The C# equivalent assumes all three which is annoying because the log files I generate use CR to separate the lines of multiline log entries.

What does ReadList assume?

Bruce/bugmagnet
 

DonManfred

Expert
Licensed User
Longtime User
It uses CRLF

Field.png
CRLF As String

New line character. The value of Chr(10).
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User
It uses CRLF

Trying:

B4X:
Dim SB As StringBuilder
    SB.Initialize
    SB.Append("Line 1").Append(Chr(13))
    SB.Append("Line 2").Append(Chr(10))
    SB.Append("Line 3").Append(CRLF)
    File.WriteString("C:\temp","test.txt",SB.ToString)
    Log(File.ReadList("C:\temp","test.txt"))

Gives:

B4X:
(ArrayList) [Line 1, Line 2, Line 3]
 
Upvote 0

Bruce Axtens

Active Member
Licensed User
Longtime User
Pity. Would like to have had the behaviour adjustable.

Anyway, thanks.
 
Upvote 0
Top