JavaScript has two handy substring functions: substring(from,to)
and substr(start,length)
.
This means I can decide "when I get my substring starting from position X, do I want to specify what string position to end on or how many characters long the substring is?"
(One nice usage of the from, to
version is to use search()
to determine both positions.)
PHP's substr()
lets you specify the length of the substring. Is there a built-in string function to let you specify the character position to end on?