05.02.2010, 18:21
strfind doesn't return how many times it's been found in a string, it returns the position of the string you've searched for.
Look at this as a string:
"John_Doe"
It would return 4.
"Jonas_Doe"
That would return 5.
This will do what you want though.
Look at this as a string:
"John_Doe"
It would return 4.
"Jonas_Doe"
That would return 5.
pawn Код:
stock StringOccInString( stringtosearchfor[], string[] ) // Calgon.
{
new tmpcount;
for( new i = 0; i < strlen( string ); i++)
{
if( strfind( string[ i ], stringtosearchfor, true ) )
{
tmpcount++;
}
}
return tmpcount;
}
