Version: v0.7.1 - Beta.  We welcome contributors & feedback.


endsWith($matchString, $options = {}) -> boolean


Check that the end of the string matches $matchString.

If $options is -ignoreCase it will match both upper and lowercase versions of each character.

//= true

//= false

'abcdef'.endsWith('DEF', -ignoreCase)
//= true

Regex Patterns

If you need to match a pattern at the end of the string, you can use match with the $ anchor instead.

// $ = end of string
'abc 123'.match(r'\d+$')
//= '123'

// i = ignore case
'Abc Xyz'.match(r'(def|xyz)$'i)
//= 'Xyz'

See Also