title: What's the best way to get rid of get parameters from url string?
body: <p>I have URL string like: </p>
  
  <p>"<a href="http://www.xyz/path1/path2/path3?param1=value1&amp;param2=value2" rel="noreferrer">http://www.xyz/path1/path2/path3?param1=value1&amp;param2=value2</a>".</p>
  
  <p>I need to get this url without parameters, so the result should be:</p>
  
  <p>"<a href="http://www.xyz/path1/path2/path3" rel="noreferrer">http://www.xyz/path1/path2/path3</a>".</p>
  
  <p>I have done it this way:</p>
  
  <pre><code>private String getUrlWithoutParameters(String url)
  {
    return url.substring(0,url.lastIndexOf('?'));
  }
  </code></pre>
  
  <p>Are there any better ways to do it?</p>