Function findSubString

  • Find a substring after a given offset.

    Example

    findSubString("42", 0, 1, 1, "Is 42 the answer?")
    // => [3, 1, 4]
    findSubString("42", 7, 1, 8, "Is 42 the answer?")
    // => [-1, 1, 18]
    findSubString("🙉", 0, 1, 1, "🙈\n\n\n1🙊🙉🙊")
    // => [8, 4, 3,]

    Note that "🙉" is two bytes long in UTF-16 and that offset is counted in bytes.

    Remarks

    Returns offset, row, and column. In that order.

    Parameters

    • smallString: string
    • offset: number
    • row: number
    • col: number
    • bigString: string

    Returns [number, number, number]