Get a section by its name

Returns null if the section is not found.

var ini = new IniFile.from_string("""
[section1]
key1=value1
[section2]
key2=value2
""")
assert ini.section("section1") isa IniSection
assert ini.section("section2").name == "section2"
assert ini.section("not.found") == null

Property definitions

ini $ IniFile :: section
	# Get a section by its `name`
	#
	# Returns `null` if the section is not found.
	#
	# ~~~
	# var ini = new IniFile.from_string("""
	# [section1]
	# key1=value1
	# [section2]
	# key2=value2
	# """)
	# assert ini.section("section1") isa IniSection
	# assert ini.section("section2").name == "section2"
	# assert ini.section("not.found") == null
	# ~~~
	fun section(name: String): nullable IniSection do
		for section in sections do
			if section.name == name then return section
		end
		return null
	end
lib/ini/ini.nit:138,2--158,4