Delete underscore from string
#1

Hello,

i try to delete an underscore (_) from a string, i try to do it in two differents way, but it does'nt work:

1st way:
pawn Код:
stock RPName(name[])
{
        new NameLenght = strlen(name);
        new value = strfind(name, "_", true);
        strdel(name, value, value+1);
        strins(name, " ", value, NameLenght);
        return name;
}
It return |dњfirstname lastname, so it work but i don't understand why there are |dњ before the name, i try to delete the three first caracter but it does'nt work.

The second way:
pawn Код:
stock Underscore(name[])
{
    for(new i=0; i<strlen(name); i++)
    {
        if (name[i] == "_") //
        {
            name[i] = " ";
            return name;
        }
    }
    return 1;
}
but it show some errors
Quote:

C:\Users\PC-HP\Desktop\pawno\gamemodes\test.pwn(1297) : error 033: array must be indexed (variable "-unknown-")
C:\Users\PC-HP\Desktop\pawno\gamemodes\test.pwn(1299) : error 006: must be assigned to an array
C:\Users\PC-HP\Desktop\pawno\gamemodes\test.pwn(1303) : error 079: inconsistent return types (array & non-array)

Reply


Messages In This Thread
Delete underscore from string - by Garwan50 - 15.08.2013, 12:44
Re: Delete underscore from string - by Misiur - 15.08.2013, 12:54
Re : Delete underscore from string - by Garwan50 - 15.08.2013, 13:12
Re: Delete underscore from string - by Jefff - 15.08.2013, 14:55
Re: Delete underscore from string - by Alexis1999 - 15.08.2013, 15:11
Re : Re: Delete underscore from string - by Garwan50 - 15.08.2013, 15:28
Re: Re : Re: Delete underscore from string - by Djole1337 - 15.08.2013, 15:30
Re : Delete underscore from string - by Garwan50 - 15.08.2013, 15:48
Re: Delete underscore from string - by MSuperXX - 15.08.2013, 15:55
Re : Delete underscore from string - by Garwan50 - 15.08.2013, 18:16

Forum Jump:


Users browsing this thread: 4 Guest(s)