String.endsWith
endsWith($matchString, $options={}) -> boolean
Description
Check that the end of the string matches $matchString
.
If $options
is -ignoreCase
it will match both upper and lowercase versions of each character.
'abcdef'.endsWith('def') //= true 'abcdef'.endsWith('DEF') //= false 'abcdef'.endsWith('DEF', -ignoreCase) //= true
Regex Patterns
The $matchString
argument can also be a Regex.
// \d+ = one or more digits 'abc 123'.endsWith(rx'\d+') //= true // i = ignore case '123 Abc'.endsWith(rx'(abc|def)'i) //= true