Number of strings in a string?
#2

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.

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;
}
This will do what you want though.
Reply


Messages In This Thread
Number of strings in a string? - by Programie - 05.02.2010, 18:07
Re: Number of strings in a string? - by Calgon - 05.02.2010, 18:21
Re: Number of strings in a string? - by ¤Adas¤ - 05.02.2010, 18:24
Re: Number of strings in a string? - by MadeMan - 05.02.2010, 18:26
Re: Number of strings in a string? - by Calgon - 05.02.2010, 18:27
Re: Number of strings in a string? - by Programie - 05.02.2010, 18:34

Forum Jump:


Users browsing this thread: 1 Guest(s)