// INI document (demo data) static immutable string iniString = `; This is a comment. Oachkatzlschwoaf = Seriously, try pronouncing this :P [Section #1] foo = bar d = rocks ; Another comment [Section No.2] name = Walter Bright company = "Digital Mars" `; // Parse the document. auto doc = parseIniDocument(iniString); // …is equivalent to: auto doc = parseIniDocument!(IniDialect.defaults)(iniString); assert(doc.sections.length == 3); // "Root" section (no name): assert(doc.sections[0].name is null); assert(doc.sections[0].items == [ IniKeyValuePair!string("Oachkatzlschwoaf", "Seriously, try pronouncing this :P"), ]); // A section with a name: assert(doc.sections[1].name == "Section #1"); assert(doc.sections[1].items.length == 2); assert(doc.sections[1].items[0] == IniKeyValuePair!string("foo", "bar")); assert(doc.sections[1].items[1] == IniKeyValuePair!string("d", "rocks")); // Another section: assert(doc.sections[2].name == "Section No.2"); assert(doc.sections[2].items == [ IniKeyValuePair!string("name", "Walter Bright"), IniKeyValuePair!string("company", "Digital Mars"), ]);
Parses an INI string into a document ("DOM").