platform-bible-utils
    Preparing search index...

    Function slice

    • This function mirrors the slice function from the JavaScript Standard String object. It operates on grapheme clusters instead of UTF-16 code units.

      Extracts a section of the string and returns it as a new string, without modifying the original.

      Parameters

      • string: string

        The starting string

      • indexStart: number

        The index of the first grapheme cluster to include. Negative values count back from the end

      • OptionalindexEnd: number

        The index of the first grapheme cluster to exclude. Negative values count back from the end. A range that ends before it starts yields an empty string

      Returns string

      A new string containing the extracted section of the string