title: C++ STD find_last_of not working?
body: <p>I'm trying to write a function that cleans a string from preceeding or trailing whitespaces.</p>
  
  <p>So basically, if you pass it the function <code>"   \tHello, this is a test!     \t"</code> then it will must return <code>"Hello, this is a test!"</code>. Here's my code, but...</p>
  
  <pre><code>string clean_str(string str)
  {
      const string alphabet("abcdefghijklmnopqrstuvwxyz1234567890åäö-");
  
      size_t first = str.find_first_of(alphabet);
      size_t last = str.find_last_of(alphabet);
      return str.substr(first, last);
  }
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      string s("         test 123-4    ");
      cout &lt;&lt; "[" &lt;&lt; clean_str(s) &lt;&lt; "]";
      Sleep(INFINITE);
      return 0;
  }
  </code></pre>
  
  <p>It returns </p>
  
  <pre><code>// s == "test 123-4    "
  </code></pre>
  
  <p>Which is wrong. I've decided to go with Boost anyway, but I still want to know why this doesn't work.</p>
  
  <p>Thanks.</p>