Ignoring whitespace's when searching for substrings

Hey All,

Is there any function within JUCE that would allow me to search for substrings within a string whilst ignoring any possible whitespace’s within the substring?
For example, when searching for the substring “foobar” any of the following instances within a string would be acceptable - “foobar”, “foo bar”, " foob ar " etc…

A handy aspect of such a function would be that it could return the number of whitespace’s found within the substring.

Actually, ignore the part about returning the number of whitespace’s - I’m currently using String::indexOf (int startIndex, const String & textToLookFor) to get the indexes of any instances of textToLookFor (therefore the idea of it returning the number if whitespaces’ isn’t possible).