Import std.data.ini
Ini
struct
Public Struct Ini
What reads and writes INI files, in its Static Methods.
Examples
Local config = Try Ini.Read("name = demo\n; a comment\n[window]\nwidth = 800\n")
Expect(config.Path("name")?.AsString() == "demo")
Expect(config.Path("window.width")?.AsString() == "800")
Expect(Ini.Write(config) == "name = demo\n\n[window]\nwidth = 800\n")-
The keys and sections
textholds. A key given again in a section takes its new value, and a section named again goes on adding to the first. Throws a ParseError of SYNTAX, with its line and column, for a line that's none of the four, a key that's empty, a header that doesn't end with ']', or a section named as a key before it is. -
value, an Object, as INI: its own keys whose values aren't Objects, then a section for each Object in it, of its keys. A String is written as it is, in '"'s when it starts or ends with a space, a tab, or a '"', a Bool, an integer, or a Double as its text, and Null as nothing. Panics at what Read wouldn't read back as the same: whenvalueisn't an Object, a section holds an Object or anything holds an Array, a key is empty, holds '=', ':', or a line break, starts with '[', ';', '#', or a byte order mark, or starts or ends with a space or a tab, a section's name holds ']' or a line break or starts or ends with a space or a tab, or a value holds a line break.
Report an issue with this page or with FutureBlitz on GitHub.