Split a string into two strings
#1

Hi, I was writing my own /me cmd for a RolePlay gamemode and I wanted to split the /me string into a two strings when it's too long.
I wrote this function:
pawn Код:
public SplitMe(textme[], len, first[], second[])
{
    new i = 0;
    new j = 0;
    while(i<40)
    {
        first[i] = textme[i];
        i++;
    }
    first[i+1] = '\0';
    while(i<len)
    {
        second[j] = textme[i];
        i++;
        j++;
    }
    return 1;
}
In this example the strlen of the first string is 40.
When I try to show the two strings with a SendClientMessage it does show just the second string!
I thought could be a problem with the string terminator so I changed this line:
pawn Код:
first[i+1] = '\0';
With:
pawn Код:
first[i+1] = 0;
With this fix the problem is just the same.
Someone can help me please? What's the problem?
Reply


Messages In This Thread
Split a string into two strings - by Gilmar - 23.03.2014, 18:08
Re: Split a string into two strings - by Vince - 23.03.2014, 18:31
Re: Split a string into two strings - by Niko_boy - 23.03.2014, 18:34
Re: Split a string into two strings - by Gilmar - 23.03.2014, 21:40

Forum Jump:


Users browsing this thread: 3 Guest(s)