Is there anything speedier than this?

Hi, i'm probably lazy searching through the juce docs, is there a way to make this more concise ?


const String filePath = file.getFullPathName();

const String wildcard = audioFormatManager.getWildcardForAllFormats();
const StringArray wildcards = StringArray::fromTokens(wildcard, " ,;", String::empty);

for (int i = 0; i < wildcards.size(); i++)
{
    if (filePath.matchesWildcard(wildcards[i], true))
        return true;
}

a method in the file object would be cool tho :)

for (auto & w: wildcards) { if (filePath.matchesWhildcard(w, true)) return true; }

You can make the for loop a little more pleasant if your compiler supports it. 

You can make a lot shorter but ramming some of that stuff together.  But I think that's just a straight trade for clarity then :)

 

You could probably use WildcardFileFilter to do it too.

yeah ! missed that class completely thanx !