For the complete documentation index, see llms.txt. This page is also available as Markdown.

hasOpening()

Wrap.hasOpening()

Checks whether the text has given opening chars at the beginning.

wrap.class.ts
public static hasOpening(text: string, opening: string): boolean {
  return (
    typeof text === 'string' &&
    text.length >= 1 &&
    typeof opening === 'string' &&
    opening.length >= 1 &&
    text.slice(0, opening.length) === opening
  );
}

Parameters

text: string

The text of string, to check whether it contains given opening chars.

opening: string

The opening chars of string to check if a given text contains.

Returns

The return value is a boolean indicating whether the text contains opening chars at the beginning.

Example usage

Last updated