I have 2 loops like below. In the second loop I am searching a string if I can find the
"*" character.
This loop will loop 100 times but what I am wondering is that if you wont find the character "*" in the string str, is is possible to end or go out of this loop, so is wont need to loop to 100 ?
In this case the second loop will only iterate i2 = 0 since there is no "*" found and not go to 1,2,3 up to 100.
Thanks..
for( int i = 0; i < 5; i++) //loop 1
{
std::string str= "Number1 - Number2";
for( int i2 = 0; i2 < 100; i2++) //loop2
{
std::string::size_type index = str.find("*", 0);
if( std::string::npos != index )
{
//Do some stuff if a "*" was found in str
}
}
}