title: C++ - checking a string for all values in an array
body: <p>I have some parsed text from the Vision API, and I'm filtering it using keywords, like so:</p>
  <pre><code>    if (finalTextRaw.find(&quot;File&quot;) != finalTextRaw.npos)
  {
      LogMsg(&quot;Found Menubar&quot;);
  }
  </code></pre>
  <p>E.g., if the keyword &quot;File&quot; is found anywhere within the string <code>finalTextRaw</code>, then the function is interrupted and a log message is printed.</p>
  <p>This method is very reliable. But I've inefficiently just made a bunch of if-else-if statements in this fashion, and as I'm finding more words that need filtering, I'd rather be a little more efficient. Instead, I'm now getting a string from a config file, and then parsing that string into an array:</p>
  <pre><code>    string filterWords = GetApp()-&gt;GetFilter();
      std::replace(filterWords.begin(), filterWords.end(), ',', ' ');  ///replace ',' with ' '
      vector&lt;int&gt; array;
      stringstream ss(filterWords);
      int temp;
      while (ss &gt;&gt; temp)
          array.push_back(temp); ///create an array of filtered words
  </code></pre>
  <p>And I'd like to have just one <code>if</code> statement for checking that string against the array, instead of many of them for checking the string against each keyword I'm having to manually specify in the code. Something like this:</p>
  <pre><code>        if (finalTextRaw.find(array) != finalTextRaw.npos)
  {
      LogMsg(&quot;Found filtered word&quot;);
  }
  </code></pre>
  <p>Of course, that syntax doesn't work, and it's surely more complicated than that, but hopefully you get the idea: if any words from my array appear anywhere in that string, that string should be ignored and a log message printed instead.</p>
  <p>Any ideas how I might fashion such a function? I'm guessing it's going to necessitate some kind of loop.</p>