Skip to content
FutureBlitz

    Install

    Import std.data.ini

    Ini

    std.data.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")

    std/data/ini.fb, line 24

    • Public Static Method Read(text: String): Value Throws ParseError static method #

      The keys and sections text holds. 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.

    • @PanicsAtCaller Public Static Method Write(value: Value): String static method #

      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: when value isn'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.