title: c++ ignore front spaces when comparing strings eg: "str1"compare.(" str2") = TRUE
body: <p>Hi I was wondering what is the shortest way to make string str1 seem equal to string str2</p>
  
  <pre><code>str1 = "Front Space";
  str2 = " Front Space";
  
  /*Here is where I'm missing some code to make the strings equal*/
  
  if (str1.compare(str2) == 0) { // They match 
      cout &lt;&lt; "success!!!!" &lt;&lt; endl; // This is the output I want
  }
  </code></pre>
  
  <p>All I need it for str1 to equal str2
  How can I do it?</p>
  
  <p>I have made multiple attempts but they all don't seem to work correctly. I think it's because of the number of characters in the string, ie: str1 has less characters than str2.</p>
  
  <pre><code>for (int i = 1; i &lt;= str1.length() + 1; i++){
      str1[str1.length() - i ] = str1[str1.length() - (i + 1)];
  }
  </code></pre>
  
  <p>Any help appreciated</p>