From SA-MP Wiki
|string1||The first string to compare.|
|string2||The second string to compare.|
|ignorecase (optional)||When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.|
|length (optional)||When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string.|
|Returns||-1 if string1 comes before string2|
1 if string1 comes after string2
0 if the strings are the same (for the matched length).
Good examples of using strcmp can be found at the Using strcmp()-Tutorial.
If you don't and compare one string from a textfile with an other variable strcmp will not return 0 (only if length is larger then the string in the file)
This is because the string in the file has \r\n for the line return at the end, so if you use strcmp to compare textfile strings do it like this:
so the \r\n in your file will be ignored because it is out of the range to compare!
The following functions may be useful, as they are related to this function in one way or another.
- Strfind: Search for a string in a string.
- Strtok: Get the next word/parameter in a string.
- Strdel: Delete part of a string.
- Strins: Insert text into a string.
- Strlen: Get the length of the string.
- Strmid: Extract part of a string into another string.
- Strpack: Pack a string into a destination.
- Strval: Convert a string into an integer.
- Strcat: Concatenate two strings into a destination reference.