Skip to content

Instantly share code, notes, and snippets.

@YoshitsuguFujii
Created December 19, 2012 08:36
Show Gist options
  • Save YoshitsuguFujii/4335313 to your computer and use it in GitHub Desktop.
Save YoshitsuguFujii/4335313 to your computer and use it in GitHub Desktop.
// String {{{
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
}
String.prototype.ltrim = function() {
return this.replace(/^\s+/, "");
}
String.prototype.rtrim = function() {
return this.replace(/\s+$/, "");
}
// }}}
// Array {{{
Array.prototype.delete_from_value = function(value) {
return this.splice(this.indexOf(value), 1);
}
// }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment