title: trim is not part of the standard c/c++ library?
body: <p>Is it me or are there no standard trim functions in the c or c++ library? is there any single function that acts as a trim? If not can anyone tell me Why trim is not part of the standard library? (i know trim is in boost)</p>
  
  <p>My trim code is</p>
  
  <pre><code>std::string trim(const std::string &amp;str)
  {
      size_t s = str.find_first_not_of(" \n\r\t");
      size_t e = str.find_last_not_of (" \n\r\t");
  
      if(( string::npos == s) || ( string::npos == e))
          return "";
      else
          return str.substr(s, e-s+1);
  }
  </code></pre>
  
  <p>test: cout &lt;&lt; trim("  \n\r\r\n \r\n text here\nwith return   \n\r\r\n \r\n ");
  -edit-
  i mostly wanted to know why it wasnt in the standard library, BobbyShaftoe answer is great. <a href="https://stackoverflow.com/questions/479080/trim-is-not-part-of-the-standard-c-c-library#479091">trim is not part of the standard c/c++ library?</a></p>