April 15, 2009 Re: Why does readln include the line terminator? | ||||
|---|---|---|---|---|
| ||||
Stewart Gordon Wrote:
> Take these four cases:
> (a) you want to process only files with a specific line ending style
> (b) you want to know what line endings are used
> (c) you don't care about what line endings are used, but still want to
> know whether or not the file ends with one
> (d) you just want to read the file line by line, without caring about
> the line endings or the presence or absence of one at the end
>
> At the moment, readln is good only for (a). readLine is good only for (d). If you want (b) or (c), you'll have to come up with an alternative means.
I think, only (d) is important, all others are *strange* things. I usually use ReadLine in conjunction with WriteLine.
| ||||
April 15, 2009 Re: Why does readln include the line terminator? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kagamin | Kagamin wrote:
> Stewart Gordon Wrote:
>
>> Take these four cases:
>> (a) you want to process only files with a specific line ending style
>> (b) you want to know what line endings are used
>> (c) you don't care about what line endings are used, but still want to know whether or not the file ends with one
>> (d) you just want to read the file line by line, without caring about the line endings or the presence or absence of one at the end
>>
>> At the moment, readln is good only for (a). readLine is good only for (d). If you want (b) or (c), you'll have to come up with an alternative means.
>
> I think, only (d) is important, all others are *strange* things. I usually use ReadLine in conjunction with WriteLine.
So you expect text editors to discard both kinds of information?
I expect any text editor (don't get me started on Notepad) to do (c), and any decent text editor to be capable of (b).
Stewart.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply