SA-MP Forums Archive
strdel - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: strdel (/showthread.php?tid=619956)



strdel - MerryDeer - 24.10.2016

Hi,

If i strdel string, and use strlenght that string lenght it's not crash server, or player client?

strdel(string,0,strlen(string) );


Re: strdel - GoldenLion - 24.10.2016

What about you hop in-game and test it?


Re: strdel - MerryDeer - 24.10.2016

I don't get crash, but i mean it's safe use for everytime?


Re: strdel - ThatFag - 24.10.2016

Why would it crash lol , the strdel - deletes a part of string.


Re: strdel - MerryDeer - 24.10.2016

But if i want to del, all string to end, i have to use strlen(string) or strlen(string)-1 ?


Re: strdel - Skimmer - 24.10.2016

You have to use strlen only. No need to subtract 1. It's safe.


Re: strdel - GoldenLion - 24.10.2016

If you want to empty a string you can just do
Код:
string[0] = EOS
or
Код:
string[0] = '\0'



Re: strdel - SickAttack - 24.10.2016

Use strdel only if you want to delete a part of a string, or equal the last index that is going to be used to EOS (End Of String).

If you want to empty a string, equal the first index (index 0) to EOS.