Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent of ucwords in java

Tags:

java

android

php

In php, the method ucwords converts any string in a string where each words first character is in uppercase, and all other characters are lower case.

I always end up making my own implementation, and I'm wondering if a standard method exists.

like image 273
XGouchet Avatar asked Feb 28 '11 15:02

XGouchet


1 Answers

That's called capitalization. Use Apache Commons's StringUtils to do that.

See more here:

http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html

WordUtils is also worth looking at. See here

like image 160
Nishant Avatar answered Sep 22 '22 14:09

Nishant