Skip to content

Main content

INI Section Occurrence Grouping

Group adjacent supplied INI section labels into distinct occurrence runs, preserving later returns to the same name rather than globally merging sections.

Loading tool…

Description

Group adjacent supplied INI section labels into distinct occurrence runs, preserving later returns to the same name rather than globally merging sections.

INI-like configuration formats vary between applications. In this tool family, assignments are explicit section/name/value records and the empty section string means global scope. Duplicate-key policies, case handling and preservation of comments are separate choices rather than one universal INI behavior.

Group adjacent supplied INI section labels into distinct occurrence runs, preserving later returns to the same name rather than globally merging sections.

When to use this tool

Use this tool to group adjacent supplied INI section labels into distinct occurrence runs, preserving later returns to the same name rather than globally merging sections.

How to use the tool and how it works

  1. Enter sections using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.occurrences. Use the ordering, boundary rules and absence conditions described below.

Group adjacent equal section labels into half-open spans and number each occurrence from zero.1

Input fieldMeaning and unitsAccepted input
sectionsExplicit section-occurrence labels, in occurrence order.Dense list of at most 128 strings, each at most 8,192 UTF-16 code units.
Output fieldInterpretation
resultObject containing the named fields below.
result.occurrencesAdjacent section-label runs with half-open spans and occurrence number.
json
{
  "input": {
    "sections": [
      "a",
      "a",
      "b",
      "a"
    ]
  },
  "output": {
    "result": {
      "occurrences": [
        {
          "key": "a",
          "start": 0,
          "end": 2,
          "occurrence": 0
        },
        {
          "key": "b",
          "start": 2,
          "end": 3,
          "occurrence": 1
        },
        {
          "key": "a",
          "start": 3,
          "end": 4,
          "occurrence": 2
        }
      ]
    }
  }
}

Limitations and assumptions

  • A later repeated section creates a new occurrence rather than merging with an earlier run.
  • Assignment records contain section, name and value strings. Nonempty section/key names cannot have surrounding whitespace, brackets or CR/LF/NUL. Values cannot contain CR/LF/NUL; a key cannot contain equals. No implicit interpolation or typed-value conversion is performed.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Select the consuming application’s dialect and duplicate-key policy explicitly. Use a lossless configuration editor when comments, original spacing, quoting or application-specific interpolation must be preserved.

References

  1. Tool behavior and example: INI Section Occurrence Grouping — tool.io

Similar or alternative tools

  • INI Empty Section Occurrence Audit

    Audit empty INI section occurrences by explicit occurrence-index assignment ownership, distinguishing repeated section headings with the same name.

  • INI Global Key Section Partition

    Partition explicit INI key observations between the unsectioned global namespace and named sections; preserves original records, duplicates and empty values.