#1

How do slipt string like:

string = [EU]AUD398

Then will slipting to "[EU] AUD 398".
Reply
#2

You can use SSCANF for that, there isn't any other way I think..

Код:
This forum requires that you wait 120 seconds between posts. Please try again in 84 seconds. ...
Reply
#3

it was stock split or what..
Reply
#4

split requires a character to judge and split, for example if you had [Eu],AUD,398, you could use split and use the comma as the reference. Since there is no comma, /, ; , :, or anything else, you need to use sscanf. Search for it.
Reply
#5

pawn Код:
stock split(const string[], string1[], string2[], character, maxsize = strlen(string)+1)
{
    format(string1, maxsize, "%s", string);
    format(string2, maxsize, "%s", string);
    strdel(string1, character+1, strlen(string));
    strdel(string2, 0, character+1);
    return 1;
}
here you go, tested
Reply
#6

Ok, i do use then AUD;398

I want it slipting to "AUD 398" without that ;

BUT how i do split??

wawa...

new string[256];
string = CarInfo[h][cPlate];
split(string); ??

// Oh i didnt see, i try now.
Reply
#7

what do you mean? use it like that:

pawn Код:
new string1[3]; //max length (3)
new string1[3]; //max length (3)
split("AUD398", string1, string2, 3);
4th parameter in split function is the after what character it should be split
and now you have two strings string1 and string2
on string1 you have AUD, on string2 you have 398
Reply
#8

Код:
new string1[4]; //max length (4)
new string1[3]; //max length (3)
new string1[3]; //max length (3)
split("[EU]AUD398", string1, string2, string3, 3);
Then?

Like..

Код:
new string1[4]; //max length (4)
new string1[3]; //max length (3)
new string1[3]; //max length (3)
split(CarInfo[h][cPlate], string1, string2, string3, 3); // ex "[EU]AUD398"
SendClientMessage(playerid, COLOR, CarInfo[h][cPlate]); // splitted
Oh.. i then use "AUD398" without [EU] etc..
Reply
#9

yes accept that i did it only that a string can be split into 2 parts so the best thing to do is to split some string one, and then one again
Reply
#10

Quote:
Originally Posted by i514x_
Посмотреть сообщение
yes accept that i did it only that a string can be split into 2 parts so the best thing to do is to split some string one, and then one again
Or use sscanf.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)