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


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


Check that the beginning of the string matches $matchString.

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

//= true

//= false

'abcdef'.startsWith('ABC', -ignoreCase)
//= true

Regex Patterns

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

// ^ = beginning of string
'123 abc'.match(r'^\d+')
//= '123'

// i = ignore case
'Abc 123'.match(r'^(abc|xyz)'i)
//= 'Abc'

See Also