title: Compare version strings in groovy
body: <p>Hey I have created a Groovy script that will extract the version numbers of some folder. I would then like to compare the version numbers and select the highest.</p>
  
  <p>I got my script to run through the dir folder and I then get the versions in this format: <code>02.2.02.01</code></p>
  
  <p>So I could get something like this:</p>
  
  <ul>
  <li>02.2.02.01</li>
  <li>02.2.02.02</li>
  <li>02.2.03.01</li>
  </ul>
  
  <p>I don't have them as a list but like this: </p>
  
  <pre><code>baseDir.listFiles().each { file -&gt; 
    def string = file.getName().substring(5, 15)
    // do stuff
  }
  </code></pre>
  
  <p>Also I have tested that Groovy could compare them with the <code>&gt;</code> operator and it can! But now I need to select the one with the highest version</p>