E-mail attachment with scrambled text.

Simen Kjærås simen.kjaras at gmail.com
Fri Jun 29 07:44:48 UTC 2018


On Thursday, 28 June 2018 at 14:42:36 UTC, vino.B wrote:
>  Thank you very much, after replacing all the '\n' with '\r\n' 
> it resolved 99% of the formatting issue expect for the below 
> function, can you help me on the same.
>
> auto getAvailableDiskSpace(Array!string UtilDrive, File logF) {
> auto result = ["/usr/bin/df", "-h", UtilDrive, 
> "--output=target,size,used,avail,pcent"].execute;
> enforce(result.status == 0);
> logF.writeln(result.output);
>
> }

std.array.replace[0] is your friend:

auto getAvailableDiskSpace(Array!string UtilDrive, File logF) {
     import std.array : replace;
     auto result = ["/usr/bin/df", "-h", UtilDrive, 
"--output=target,size,used,avail,pcent"].execute;
     enforce(result.status == 0);
     logF.writeln(result.output.replace("\n", "\r\n"));
}

--
   Simen

[0]: https://dlang.org/phobos/std_array.html#.replace


More information about the Digitalmars-d-learn mailing list