Articles tagged with #substr




Negative Substr, Why Must You Plague Me?

Twice over the past few weeks using a negative start value for both String.substr and Array.splice has come back to bite me. So, for the record, if you are use to using: // should return 'bar' 'foobar'.substr(-3); // should return [2,3,4] [0,1,2,3,4 …