0

I've looked around extensively for a solution, couldn't find anything specific to what I'm looking to do. When I found a partial solution, my addition to that code wasn't working.

For example, given the string "hellO This is uNformaTTED", the solution would be "Hello This Is Unformatted".

I've looked at the problem in different ways, none of which I can get to work.

Shox2711
  • 139
  • 1
  • 12
  • 1
    in what language? And what have you tried...it should be doable in most languages, but more info please :) – Aidan Moriarty May 08 '16 at 16:43
  • My apologies, I've been so wrapped up in studying for my exam that I've lost focus on asking questions correctly lol. Language is Java – Shox2711 May 08 '16 at 16:43
  • My most recent attempt – Shox2711 May 08 '16 at 16:44
  • String data = "hello wORLd"; String[] sentence = data.split("\\s"); data = ""; for (int i = 0; i < sentence.length; i++){ char capLetter = Character.toUpperCase(sentence[i].charAt(0)); data += " " + capLetter + sentence[i].substring(1); } data = data.trim(); System.out.println(data); – Shox2711 May 08 '16 at 16:44
  • 1
    http://stackoverflow.com/questions/1892765/how-to-capitalize-the-first-character-of-each-word-in-a-string – fpilee May 08 '16 at 16:44
  • Thanks Felipe. I looked at that question earlier and got put off from using it because it seemed more complex than it needed to be. I'll read through it more thoroughly and try grasp and understanding. Thanks for the help! – Shox2711 May 08 '16 at 16:49

0 Answers0