Characters Removal.
#1

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

Look at strdel.

Something like:
pawn Код:
strdel(string, 0, 1);
strdel(string, strlen(string)-1, strlen(string));
Reply
#3

Well it wouldn't work because strdel will delete string characters that a hexadecimal.
Reply
#4

Someone?
Reply
#5

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

No idea how to use it..
Reply
#7

pawn Код:
stock clearStringCharacters(string[]) {
   strdel(string, 0, 1);
   strdel(string, strlen(string)-1, strlen(string));
   return string;
}
Usage:
clearStringCharacters("0x33AA33AA");
Reply
#8

Doesn't work.
Reply
#9

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;
}
Reply
#10

Doesn't work again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)