title: How to convert String to char array without spaces in Java?
body: <p>Hi everybody I writing java code which counts characters. When I convert String using toCharArray I cant use regex to eliminate whitespaces.</p>
  
  <pre><code>    System.out.println( "Enter a string:" ); 
      String input = scanner.nextLine();
  
      // tokenize the input
      char[] chars = input.toCharArray();
  </code></pre>