• This function mirrors the slice function from the JavaScript Standard String object. It handles Unicode code points instead of UTF-16 character codes.

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

    Parameters

    • string: string

      The starting string

    • indexStart: number

      The index of the first character to include in the returned substring.

    • OptionalindexEnd: number

      The index of the first character to exclude from the returned substring.

    Returns string

    A new string containing the extracted section of the string.