title: How to trim a string after a specific character in java
body: <p>I have a string variable in java having value:</p>
  
  <pre><code>String result="34.1 -118.33\n&lt;!--ABCDEFG--&gt;";
  </code></pre>
  
  <p>I want my final string to contain the value:</p>
  
  <pre><code>String result="34.1 -118.33";
  </code></pre>
  
  <p>How can I do this? I'm new to java programming language.</p>
  
  <p>Thanks,</p>