parseIniMergedAA

Parses an INI string into a section-less associate array. All sections are merged.

  • Section names are discarded.
  • Duplicate keys cause values to get overwritten.
@safe pure nothrow
string[immutable(char)[]]
parseIniMergedAA
()
(
string rawIni
)

Examples

	static immutable demoData = `
key0 = value0

[1]
key1 = value1
key2 = other value

[2]
key1 = value2
key3 = yet another value`;

	// Parse INI file into an associative array with merged sections.
	string[string] aa = parseIniMergedAA(demoData);

	// As sections were merged, entries sharing the same key got overridden.
	// Hence, there are only four entries left.
	assert(aa.length == 4);

	// The "key1" entry of the first section got overruled
	// by the "key1" entry of the second section that came later.
	assert(aa["key1"] == "value2");

	// Entries with unique keys got through unaffected.
	assert(aa["key0"] == "value0");
	assert(aa["key2"] == "other value");
	assert(aa["key3"] == "yet another value");

See Also

Meta