string.find() doesn't return -1
<p>The code below is simple. As I know, if string::find() didn't find matches it returns -1. But for some reasons the code below doesn't work. Everytime I run this code I get endless loop. Thank you for help!</p>

<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;
using namespace std;

int main()
{
    string text;
    text = "asdasd ijk asdasd";
    string toReplace = "ijk";
    cout&lt;&lt;text&lt;&lt;endl;
    int counter = 0;
    while ( text.find(toReplace) != -1)
        counter++;

    cout&lt;&lt;counter&lt;&lt;endl;

    system("pause");
}
</code></pre>
