title: Finding the index of a string
body: <p>I have a filter on a fileopen dialog</p>
  
  <pre><code>  Docs := 'Indscannet fil (*.jpg)|*.jpg|Indscannet fil (*.tif)|*.tif|' +
            'Word 2007 dokument (*.docx)|*.docx|Word 2003 dokument (*.doc)|*.doc|' +
            'PDF fil (*.pdf)|*.pdf|Alle filer (*.*)|*.*';
  </code></pre>
  
  <p>When I have selected a file, lets say it is called stack.pdf, I want to know that it was type 5 (jpg=1, tif=2, docx=3, doc=4, pdf=5)</p>
  
  <p>How to do this in the easiest way?</p>
  
  <p>The reason for all this is that the users almost always adds several documents of the same type and if this is a PDF I know that is number 5 in my filter and next time the user adds a file I can set dlgOpen.FilterIndex to 5e from the beginning so they won't have to select it each time. If it is 20 documents it might save a couple of minuttes.</p>