11.08.2018, 16:34
Original poster:
strfind is used to find a specific substring in a string. Lets say you have this string:
"I am a duck"-
if you use strfind, the function will search through the string until it finds what you are looking for.
lets try to find "am"?
strfind returns 2. (because "am" was found on the 3rd spot in the string.)
You should definitly use strcmp (read it as stringcompare). This function compares the original string with the string you want to find, and it has to be exactly the same.
"am" is not equal to "I am a duck".
Same goes to your problem. If you want to find "0" or "13" - you need to compare the entire word.
strfind searching for "1" will locate every number with 1 in it in your case - and delete them.
strcmp will not, as it will only take care of the "exact" same.
Available documentation on the functions here:
https://sampwiki.blast.hk/wiki/Strfind
https://sampwiki.blast.hk/wiki/Strcmp
You should get familiar with it's differences and use them correctly.
strfind is used to find a specific substring in a string. Lets say you have this string:
"I am a duck"-
if you use strfind, the function will search through the string until it finds what you are looking for.
lets try to find "am"?
strfind returns 2. (because "am" was found on the 3rd spot in the string.)
You should definitly use strcmp (read it as stringcompare). This function compares the original string with the string you want to find, and it has to be exactly the same.
"am" is not equal to "I am a duck".
Same goes to your problem. If you want to find "0" or "13" - you need to compare the entire word.
strfind searching for "1" will locate every number with 1 in it in your case - and delete them.
strcmp will not, as it will only take care of the "exact" same.
Available documentation on the functions here:
https://sampwiki.blast.hk/wiki/Strfind
https://sampwiki.blast.hk/wiki/Strcmp
You should get familiar with it's differences and use them correctly.