Getting substring from String in java
<p>I have a string that contains data with different values, something like </p>

<pre><code>String values = "firstname=john&amp;lastname=fob&amp;email=something@something.com&amp;Telephone=3874813781"
</code></pre>

<p>FYI: <code>&amp;</code> is the separator.</p>

<p>I want to make a new string for all these parameters - firstname, lastname, email and etc... - and I want the string to contain only the value of it specific parameter something like </p>

<pre><code>String firstname = "john";
</code></pre>

<p>and same for <code>lastname</code> and so on. I think it is not better to use </p>

<pre><code>String firstname = values.indexOf(10);
</code></pre>

<p>because I don't know how many characters would the <em>username</em> contain so I could go for lastname an so, I was wondering if there is a better way for getting the values of each parameter and assign it to a new string.</p>