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

String.substring

substring($start, $length = 0) -> string

Description

Get the inner string beginning at $start, and $length characters.

If $length is 0 (default), return the rest of the string.

If $start is negative, it counts from the end of the string.

'abcdef'.substring(4)
//= 'def'

'abcdef'.substring(4, 2)
//= 'de'

'abcdef'.substring(-3, 3)
//= 'def'

See Also