Strcmp FR
From SA-MP Wiki
(Difference between revisions)
Revision as of 10:02, 21 January 2014
Page d'Accueil | Les Fonctions | Les Callbacks | Les bases du Scripting | Plugins de Serveur | Tutoriaux
Ne prenez pas en compte les FR dans les noms
Description:
Compare deux chaînes pour voir si elles sont indentiques.
(const string1[], const string2[], bool:ignorecase, length)
string1 | La première chaîne à comparer. |
string2 | La deuxième chaîne à comparer. |
ignorecase (optionnel) | (Booléen) Ignorer la casse (majuscules) |
length (optionnel) | Le nombre de caractère à comparer. (Si vaut 4, la fonction dira que "Salut" et "Salupard" seront les mêmes chaînes. |
De bons exemples sont trouvables ici: Utiliser strcmp
public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/commande", true)) // Si strcmp retourne 0, et que donc cmdtext vaut "/commande" { SendClientMessage(playerid, -1, "Tu as tapé /commande !"); return 1; } return 0; }
Fonctions Relatives
Les fonctions suivantes peuvent être utiles car elles sont indirectement ou directement liées a cette fonction.
- strfind: Search for a string in another string.
- strtok: Get the next 'token' (word/parameter) in a string.
- 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.