Function splitRanges

Splits a source string into ranges:

const ranges = splitRanges("hello;there;fella", ";");

Each range consists of:

{
text: string - the text of range
start: number - start pos of range, wrt to source
end: number - end pos of range, wrt to source
index: number - index of range (starting at 0)
}
  • Parameters

    • source: string
    • split: string

    Returns readonly Range[]