Can someone explain me the "split" funcition?
#1

pawn Код:
public split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc)){
        if(strsrc[i]==delimiter || i==strlen(strsrc)){
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}
Can someone explain to me, how to properly use it? Cause I'm having a hard time understanding what it returns to you and what string is what... :/
Reply
#2

You can use it to split a player's name using the "_" in his name...
So if he is "FirstName_SecondName", you can split them using "_" and therefor getting:
-Only the FirstName
-Only the SecondName
-Name with this format: FirstName SecondName (notice the "_" is gone)


Glad to help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)