# String.prototype.capitalize

**URL:** <https://es.discourse.group/t/string-prototype-capitalize/319>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [April 24, 2020, 5:53pm UTC](https://es.discourse.group/t/string-prototype-capitalize/319 "2020-04-24T17:53:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikhalev-im](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mikhalev-im](https://es.discourse.group/u/mikhalev-im)\
**Post date:** [April 24, 2020, 5:53pm UTC](https://es.discourse.group/t/string-prototype-capitalize/319/1 "2020-04-24T17:53:27Z")

</div>

Hello,

One common string formatting operation is to capitalize a string. Since strings are immutable, the easiest way to do that would be something like

`str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()`

which is too much in my opinion for such a simple operation.

One workaround for that would be to use css `text-transform`, but you can't do that in node.

It would be very handy to have a built in method for that and I guess it can be easily added.

Sorry If this was already discussed somewhere and there is a reason not to do it, I checked the search here and on github but haven't found anything.

---

<div class="post-metadata">

**Author:** ![michael](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/michael/32/11_2.png) [@michael](https://es.discourse.group/u/michael)\
**Post date:** [April 27, 2020, 11:04pm UTC](https://es.discourse.group/t/string-prototype-capitalize/319/2 "2020-04-27T23:04:43Z")

</div>

It sounds like what you would want is Unicode's title casing operation, which I would expect Intl to be able to handle. Unfortunately, I don't think Intl has that functionality yet.
