• This splits an input string on the given split string (e.g., ), but checks if the string is quoted or escaped.

    Given an input string like a "b c" d, with a space character as split, and escapeQuote set to true, this splits the arguments similar to common shell interpreters (i.e., a, b c, and d).

    When escapeQuote is set to false instead, we keep quotation marks in the result (i.e., a, "b c", and d.).

    Parameters

    • inputString: string

      The string to split

    • escapeQuote: boolean = true

      Keep quotes in args

    • split: string = ' '

      The single character to split on (can not be backslash or quote)

    Returns string[]