Пређи на главни садржај

strfind

warning

This function starts with a lowercase letter.

Description​

Search for a sub string in a string.

NameDescription
const string[]The string you want to search in (haystack).
const sub[]The string you want to search for (needle).
bool: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.

Returns​

The number of characters before the sub string (the sub string's start position) or -1 if it's not found.

Examples​

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!");
}
  • strcmp: Compare two strings to check if they are the same.
  • strdel: Delete part of a string.
  • strins: Insert text into a string.
  • strlen: Get the length of a string.
  • strmid: Extract part of a string into another string.
  • strpack: Pack a string into a destination string.
  • strval: Convert a string into an integer.
  • strcat: Concatenate two strings into a destination reference.