On Thursday, 31 August 2017 at 14:44:07 UTC, vino wrote:
Hi All,

Can some provide me a example of how to remove all blank lines from a file.

From,
Vino.B

ubyte[] fileData;
ubyte[] writeThis;
uint lastP;

fileData = readRaw(fileName);

foreach(uint p; ubyte b;fileData)
{
    if (b == '\n')
    {
        writeThis ~= fileData[lastP .. p];
        lastP = p;
    }
}

write(fileName, fileData);

Reply via email to