How to set constant value to environment variable at compile time?

Neia Neutuladh neia at ikeran.org
Mon Dec 10 18:23:09 UTC 2018


On Mon, 10 Dec 2018 17:58:32 +0000, aliak wrote:
> string parseConfig(string str) {
>    string ret;
>    foreach (line; str.split("\n")) {
>      auto parts = line.split("=");
>      ret ~= `string ` ~ parts[0] ~ ` = "` parts[2] `";`;
>    }
>    return ret;
> }

That works as long as none of the environment variable values contain a 
double quote or a newline character.


More information about the Digitalmars-d-learn mailing list