0

I have a String that contain few word i need that each first letter of the word will be upper case

Example: String Name= "jean cristoff";

result: Jean Cristoff

how can i do that?

Thanks for helping!!

Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103
joula
  • 93
  • 2
  • 5
  • possible duplicate of [How to upper case every first letter of word in a string?](http://stackoverflow.com/questions/1149855/how-to-upper-case-every-first-letter-of-word-in-a-string) – Joachim Sauer May 04 '11 at 12:04

1 Answers1

0
Strings[] strings = name.split(" ");
StringBuilder builder = new StringBuilder();
for (String string : string) {

  String str = string.substring(0,1).toUpperCase() + string.substring(1,string.length());
  builder.append(str).append(" ");
}
String result = builder.toString();
Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103