Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Stringの startsWith, endsWith
String.prototype.startsWith = function(prefix) {
return this.lastIndexOf(prefix, 0) == 0;
String.prototype.endsWith = function(suffix) {
return this.lastIndexOf(suffix) == this.length-suffix.length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.