Read Complete File to Array of Lines
Graham Fawcett
fawcett at uwindsor.ca
Fri May 11 13:10:02 PDT 2012
On Friday, 11 May 2012 at 20:06:45 UTC, Era Scarecrow wrote:
> On Friday, 11 May 2012 at 19:24:49 UTC, Graham Fawcett wrote:
>> It sure would. I suspect that Jesse's approach...
>>
>> readText("file.in").splitLines()
>>
>> ...would be the most efficient way if you need an actual
>> array: slurp the whole file at once, then create an array of
>> memory-sharing slices.
>
> Doesn't sound hard.. I could likely write a quick line
> splitting ranges fairly quickly, assuming \r and \n are the
> newlines, if there's new ones I'm unaware of then it may not
> work quite as well as you want :P
>
> Let's see....
Hold on! It already exists:
std.file.readText
std.string.splitLines
Graham
More information about the Digitalmars-d-learn
mailing list