How to split on first delimiter
<p>Say I have an array of items I want to split on (this is for a page ).</p>

<p>I'm trying to 'intelligently' extract out a title, but only the relevant part.</p>

<p>I also dont want leading/trailing spaces.</p>

<p>I'm not quite sure how to go about doing this though.. without putting a bunch of loops inside of other loops.</p>

<pre><code>function cleanTitle(title) {
    // Extract up to first delimiter
    var delims = ['|','·','-',':'];
} 
</code></pre>

<p>I am using jquery.</p>

<p>I also put the delims array in order of what I feel is most important. Instead of searching the entire title for the first array item before moving on to the next, I think it should do the entire string one letter at a time... each letter of the string it will check if its contained within that array. If not, it moves on. I know a lot of urls might contain even 3 out of all 4 of these, and then it wouldnt really work well otherwise.</p>
