Function startsEnds

Returns true if source starts and ends with start and end. Case-sensitive. If end is omitted, the the start value will be used.

startsEnds(`This is a string`, `This`, `string`); // True
startsEnds(`This is a string`, `is`, `a`); // False
starsEnds(`test`, `t`); // True, starts and ends with 't'
  • Parameters

    • source: string

      String to search within

    • start: string

      Start

    • end: string = start

      End (if omitted, start will be looked for at end as well)

    Returns boolean

    True if source starts and ends with provided values.