title: How do I Remove text before a space in java?
body: <pre><code>String str = "hello world";
  int spacePos = str.indexOf(" ");
  if (spacePos &gt; 0) {
      String youString = str.substring(0, spacePos - 1);
      System.out.println(youString);
  }
  </code></pre>
  
  <p>I want <em>"world"</em> as a result. How do I get this result?</p>