title: Coverting String to LocalTime with/without nanoOfSeconds
body: <p>I need to convert a string to LocalTime (java-8 not joda) that may or maynot have nanoOfSeconds in the string. The String format is in the form of 
      <code>07:06:05</code> or <code>07:06:05.123456</code> 
  The string may or may not have a decimal place in the seconds and when it does there could be any number of characters to represent the Nano Seconds part. </p>
  
  <p>Using a DateTimeForamtter such as</p>
  
  <pre><code>DateTimeFormatter dtf = DateTimeFormatter.ofPattern("H:mm:ss");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>DateTimeFormatter dtf = DateTimeFormatter.ofPattern("H:mm:ss.SSSSSS");
  </code></pre>
  
  <p>I can use an IF statement to distinguish between the two formats such as:</p>
  
  <pre><code>DateTimeFormatter dtf;
  if (time1.contains(".") {
     dtf = DateTimeFormatter.ofPattern("H:mm:ss.SSSSSS);
  } else {
     dtf = DateTimeFormatter.ofPattern("H:mm:ss);
  }
  </code></pre>
  
  <p>This works fine and I'm OK with this but I need to be able to also use a varying number of positions after the decimal point. </p>
  
  <p>A sample data set might be:</p>
  
  <pre><code>[11:07:59.68750, 11:08:00.781250, 11:08:00.773437500, 11:08:01]
  </code></pre>
  
  <p>Is there a way to allow the formatter to parse any number of digits after the decimal without it throwing a <code>java.time.format.DateTimeParseException</code> when the number of decimal places is unknown?</p>
  
  <p>I'm hoping I missing something really simple.</p>