title: How to validate geographic coordinates?
body: <p>I'm trying to validate the text of a <code>JTextField</code>. The content of this textfield should be something like this <code>66.160507, -153.369141</code> or <code>66.160507,-153.369141</code> (without whitespace after the comma).
  So far I validate only the range for both latitude and longitude.
  Here:</p>
  
  <pre><code> String [] splitted = jtextField.getText().split(",");
   double latitude = Double.parseDouble(splitted[0]);
   double longitude = Double.parseDouble(splitted[1])
  
  if(latitude &lt; -90 || latitude &gt; 90)
    return false;
  else
    continue;
  
  if(longitude &lt; -180 || longitude &gt; 180)
        return false;
      else
        continue;
  </code></pre>
  
  <p>but now how can I check whether the text in the <code>JTextField</code> is in the right format and order? I need to validate these two cases:</p>
  
  <pre><code>must be a double -&gt; must be a comma -&gt; must be a whitespace -&gt; must be a double 
  must be a double -&gt; must be a comma -&gt; must be a double 
  </code></pre>