Example:
auto content = readProcFile("/proc/meminfo");
auto pairs = parseKeyValuePairs(content);
writeln("MemTotal: ", pairs.get("MemTotal", ""));string[string] parseKeyValuePairs(string content) @safe nothrowParses a /proc file and extracts key-value pairs.
Many /proc files contain lines like "key: value" or "key value".
content | Content of the /proc file. |
Example:
auto content = readProcFile("/proc/meminfo");
auto pairs = parseKeyValuePairs(content);
writeln("MemTotal: ", pairs.get("MemTotal", ""));