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

String.hasIndex

hasIndex($index) -> boolean

Description

Check if $index is within the bounds of the string.

A negative index counts from the end of the string.

'abcdef'.hasIndex(1)
//= true

'abcdef'.hasIndex(2)
//= true

'abcdef'.hasIndex(100)
//= false

'abcdef'.hasIndex(-1)
//= true

''.hasIndex(2)
//= false

See Also