Skip to content

Main content

Ini Inline Comment Boundary Policy

Split explicit unquoted INI value text at the first caller-defined inline comment marker under an explicit preceding-whitespace policy.

Loading tool…

Description

Split a value at its first comment marker satisfying a supplied boundary policy.

Text parsers operate on an explicit source grammar and boundary policy. Recognizing delimiters or removing one prefix is distinct from validating the surrounding document or protocol. Preserve whether an output represents raw source spelling or decoded text, especially where quoted empty values, ASCII escapes, case and whitespace affect interpretation.

Split a value at its first comment marker satisfying a supplied boundary policy.

When to use this tool

Use Ini Inline Comment Boundary Policy when you already have valueText, commentMarker, requireWhitespaceBefore and need to split a value at its first comment marker satisfying a supplied boundary policy.

How to use the tool and how it works

  1. Enter valueText, commentMarker, requireWhitespaceBefore. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read valueBeforeComment, commentText, commentFound. Inspect commentFound before interpreting the associated values.

Require commentMarker nonempty; scan left to right. With requireWhitespaceBefore, accept only position zero or a marker preceded by ASCII space/tab. Return untrimmed value/comment slices and commentFound.1

Input fieldMeaning and unitsAccepted input
valueTextValue TextRequired. Text; maximum UTF-16 length 8192.
commentMarkerComment MarkerRequired. Text; minimum UTF-16 length 1; maximum UTF-16 length 8192.
requireWhitespaceBeforeOnly ASCII space/tab or position zero qualifies; quoting is not recognized.Required. Boolean.
Output fieldInterpretationReturned shape
valueBeforeCommentValue Before CommentRequired. Text; maximum UTF-16 length 8192.
commentTextComment TextRequired. Text; maximum UTF-16 length 8192.
commentFoundComment FoundRequired. Boolean.
json
{
  "input": {
    "valueText": "red ; note",
    "commentMarker": ";",
    "requireWhitespaceBefore": true
  },
  "output": {
    "valueBeforeComment": "red ",
    "commentText": " note",
    "commentFound": true
  }
}

Limitations and assumptions

  • No quote or escape handling is applied; marker text can be multiple characters, and a marker inside quoted wording still splits.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a parser for the complete intended grammar and dialect when document validity matters. Keep source spelling, decoded values, quote/escape context and whitespace rules explicit; these helpers intentionally operate on one delimiter, prefix, field or protocol component.

References

  1. Calculation and input contract: parse/ini-inline-comment-boundary-policy — tool.io

Similar or alternative tools