Last active
August 29, 2015 14:03
-
-
Save st98/cf125d85ffa9741d99ba to your computer and use it in GitHub Desktop.
Python の str#title みたいな感じで。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.title = function () { | |
return this.replace(/[A-Za-z]+/g, function (m) { | |
return m[0].toUpperCase() + m.slice(1).toLowerCase(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment