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

    Determines whether the string begins with the characters of a specified string, returning true or false as appropriate.

    Parameters

    • string: string

      String to search through

    • searchString: string

      The characters to be searched for at the start of this string.

    • position: number = 0

      The start position at which searchString is expected to be found (the index of searchString's first character). Default is 0

    Returns boolean

    True if the given characters are found at the beginning of the string, including when searchString is an empty string; otherwise, false.