IniLikeFile.leadingComments

Leading comments.

class IniLikeFile
@nogc @safe final const nothrow pure
leadingComments
()

Return Value

Type: auto

Range of leading comments (before any group)

Examples

auto ilf = new IniLikeFile();
assert(ilf.appendLeadingComment("First") == "#First");
assert(ilf.appendLeadingComment("#Second") == "#Second");
assert(ilf.appendLeadingComment("Sneaky\nKey=Value") == "#Sneaky Key=Value");
assert(ilf.appendLeadingComment("# New Line\n") == "# New Line");
assert(ilf.appendLeadingComment("") == "");
assert(ilf.appendLeadingComment("\n") == "");
assert(ilf.prependLeadingComment("Shebang") == "#Shebang");
assert(ilf.leadingComments().equal(["#Shebang", "#First", "#Second", "#Sneaky Key=Value", "# New Line", "", ""]));
ilf.clearLeadingComments();
assert(ilf.leadingComments().empty);

See Also

Meta