title: C++: case-insensitive first-n-characters string comparison
body: <p>My question is similar to <a href="https://stackoverflow.com/questions/11635/case-insensitive-string-comparison-in-c">this</a>, but I have two strings (as <code>char *</code>) and the task is to replace <code>strnicmp</code> function (avaible only for MS VC) with something like <code>boost::iequals</code>. </p>
  
  <p>Note <code>strnicmp</code> is not <code>stricmp</code> - it only compares first n characters.</p>
  
  <p>Is there any solution simplier than this:</p>
  
  <pre><code>void foo(const char *s1, const char *s2) 
  {
      ...
  
      std::string str1 = s1;
      std::string str2 = s2;
      int n = 7;
  
      if (boost::iequals(str1.substr(0, n), str2)) {
          ...
      }
  }
  </code></pre>