title: Java convert string to string array by spaces
body: <p>I would like to convert string to string array.. I have done something like this:</p>
  
  <pre><code>String name = "name";
  String[] letters = name.split("(?&lt;=.)");
  System.out.println("letters = " + Arrays.toString(letters));
  </code></pre>
  
  <p>But now I want something like this:</p>
  
  <pre><code>String name = "John Mark Lester Andrew Todd";
  </code></pre>
  
  <p>To print array like this:</p>
  
  <pre><code>[John, Mark, Lest, Andrew, Todd]
  </code></pre>
  
  <p>So I want to look for spaces in my string and then put them into a string array. Do you have ideas to do this? Help is much appreciated. Thanks.</p>