New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request new feature ".toTitleCase" #77
Comments
This is a good idea, I'll leave it open for reference. |
any idea when will this implement? |
Not sure, but you can extend var S = require('string')
MyS.prototype = S('');
MyS.prototype.constructor = MyS;
function MyS(val) {
this.setValue(val);
}
MyS.prototype.toTitleCase = function() {
var newStr = this.s.split(' ').map(function(w) { return w.substr(0, 1).toUpperCase() + w.substr(1) }).join(' ');
return new this.constructor(newStr);
}
S = function(str) {
return new MyS(str);
}
var w = S('a simple CCTV test').toTitleCase().s;
console.log(w) as an example... |
i need this function in a lot of places, can this be add in to core? So i no need to copy paste the script a over my website. |
Sure. Pull requests with tests welcome. On Monday, May 19, 2014, chongwang87 notifications@github.com wrote:
Simple & Secure Bitcoin Wallet: https://www.coinbolt.com |
Pull request created |
Wish to has a function to convert string to title case.
for example:
'a simple CCTV test' -> 'A Simple CCTV Test'
It's good only convert words except 'a, and, the... etc'
And do not lower user's input upper case
The text was updated successfully, but these errors were encountered: