Description:
Search for a sub string in a string.
Parameters:
(const string[],const sub[],bool:ignorecase=false,pos=0)
const string[] The string you want to search in (haystack).
const sub[] The string you want to search for (needle).
ignorecase (optional) When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
Position (optional) The offset to start searching from.
Return Values:
The number of characters before the sub string (the sub string's start position) or -1 if it's not found.
Example Usage:
Search for a sub string in a string.
Parameters:
(const string[],const sub[],bool:ignorecase=false,pos=0)
const string[] The string you want to search in (haystack).
const sub[] The string you want to search for (needle).
ignorecase (optional) When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
Position (optional) The offset to start searching from.
Return Values:
The number of characters before the sub string (the sub string's start position) or -1 if it's not found.
Example Usage:
- Código:
if(strfind("Are you in here?", "you", true) != -1) //returns 4, because the start of 'you' (y) is at index 4 in the string
{
SendClientMessageToAll(0xFFFFFFFF, "I found you!");
}
Creditos: WIKI SA-MP