parseKeyValuePairs

fnstring[string] parseKeyValuePairs(string content) @safe nothrow

Parses a /proc file and extracts key-value pairs.

Many /proc files contain lines like "key: value" or "key value".

Parameters

contentContent of the /proc file.

Returns

Associative array mapping keys to values.

Example:

auto content = readProcFile("/proc/meminfo");
auto pairs = parseKeyValuePairs(content);
writeln("MemTotal: ", pairs.get("MemTotal", ""));