Characters Removal. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Characters Removal. (
/showthread.php?tid=255405)
Characters Removal. -
Exsite - 15.05.2011
I need a function that can remove two characters from the end and two characters from the start.
like that:
RemoveCharacters(0x33AA33AA);
And the function will return 33AA33.
Re: Characters Removal. -
__ - 15.05.2011
Look at
strdel.
Something like:
pawn Код:
strdel(string, 0, 1);
strdel(string, strlen(string)-1, strlen(string));
Respuesta: Characters Removal. -
admantis - 15.05.2011
Well it wouldn't work because strdel will delete string characters that a hexadecimal.
Re: Characters Removal. -
Exsite - 15.05.2011
Someone?
Re: Respuesta: Characters Removal. -
__ - 15.05.2011
Quote:
Originally Posted by admantis
Well it wouldn't work because strdel will delete string characters that a hexadecimal.
|
Yes, it would work if you enter a string in a string format.
Re: Characters Removal. -
Exsite - 15.05.2011
No idea how to use it..
Re: Characters Removal. -
__ - 15.05.2011
pawn Код:
stock clearStringCharacters(string[]) {
strdel(string, 0, 1);
strdel(string, strlen(string)-1, strlen(string));
return string;
}
Usage:
clearStringCharacters("0x33AA33AA");
Re: Characters Removal. -
Exsite - 15.05.2011
Doesn't work.
Re: Characters Removal. -
MyLife - 15.05.2011
Try this...
pawn Код:
// Original by __
stock clearStringCharacters(string[]) {
new str[128];
format(str,128,"%s",string);
strdel(str, 0, 2);
strdel(str, strlen(str)-2, strlen(str));
return str;
}
Re: Characters Removal. -
Exsite - 15.05.2011
Doesn't work again.