Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "string/ends-with/docs/types/index.d"

Index

Functions

Functions

Export assignment endsWith

  • endsWith(str: string, search: string, len?: undefined | number): boolean
  • Test if a string ends with the characters of another string.

    Parameters

    • str: string

      input string

    • search: string

      search string

    • Optional len: undefined | number

      substring length (default: str.length)

    Returns boolean

    boolean indicating if the input string ends with the search string

    Example

    var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'boy?' );
    // returns true

    Example

    var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'Boy?' );
    // returns false

    Example

    var bool = endsWith( 'To be, or not to be, that is the question.', 'to be' );
    // returns false

    Example

    var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 );
    // returns true

    Example

    var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 );
    // returns true