Remove an line from .txt file
#9

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.
Reply


Messages In This Thread
Remove an line from .txt file - by GospodinX - 09.08.2018, 22:05
Re: Remove an line from .txt file - by GospodinX - 10.08.2018, 15:12
Re: Remove an line from .txt file - by [WSF]ThA_Devil - 10.08.2018, 15:36
Re: Remove an line from .txt file - by jlalt - 10.08.2018, 16:19
Re: Remove an line from .txt file - by GospodinX - 10.08.2018, 19:57
Re: Remove an line from .txt file - by Logic_ - 10.08.2018, 20:19
Re: Remove an line from .txt file - by Jefff - 10.08.2018, 20:33
Re: Remove an line from .txt file - by jlalt - 11.08.2018, 16:10
Re: Remove an line from .txt file - by denNorske - 11.08.2018, 16:34
Re: Remove an line from .txt file - by GospodinX - 11.08.2018, 21:56

Forum Jump:


Users browsing this thread: 1 Guest(s)