String Parsing in Java
<p>I am trying to parse a string something like this:</p>

<p>Input "20:00" - output would be "20"
Input "02:30" - output would be "2"
Input "00:30" - output would be "".</p>

<p>This is how I have written, I don't like the way I am doing it, looking for more efficient way to do this may be in a single scan. Any ideas?</p>

<pre><code>private String getString(final String inputString)
{
    String inputString = "20:00"; // This is just for example       
    final String[] splittedString = inputString.split(":");
    final String firstString = splittedString[0];
    int i;
    for (i = 0; i &lt; firstString.length(); i++)
    {
        if (firstString.charAt(i) != '0')
        {
            break;
        }
    }

    String outputString = "";
    if (i != firstString.length())
    {
        outputString = firstString.substring(i, firstString.length());
    }

    return outputString;
}
</code></pre>
