Remove whitespaces and capitalize user input
<p>I've made the code so it asks the user various questions, and if the <code>input.trim().isEmpty()</code> a message will be given to the user and will ask the user to input again. So if the user just writes blank spaces, message given. If the user gives a few blank spaces and some characters, it will accept.</p>

<p>Problem right now is that I want to capitalize the first letter of the Word, but it doesn't really work. Say if the user's input start with a letter then that will be capitalized. But if there's whitespace it wont capitalize at all.</p>

<p>So if input is:</p>

<blockquote>
  <p>&nbsp;&nbsp;&nbsp;&nbsp;katka</p>
</blockquote>

<p>Output is:</p>

<blockquote>
  <p>katka</p>
</blockquote>

<p>Another example:</p>

<blockquote>
  <p>katka</p>
</blockquote>

<p>Output is:</p>

<blockquote>
  <p>Katka</p>
</blockquote>

<p>Code is:</p>

<pre><code>String askWork = input.nextLine();

String workplace = askWork.trim().substring(0,1).toUpperCase()
 + askWork.substring(1);
</code></pre>

<p>while (askWork.trim().isEmpty()){
String askWork = input.nextLine();</p>

<pre><code>String workplace = askWork.trim().substring(0,1).toUpperCase()
 + askWork.substring(1);
</code></pre>

<p>}</p>

<p>I've tried different approaches but no success.</p>