Implement String.prototype.substr