Replace ' ' with '_'
#6

Quote:
Originally Posted by Mellnik
Посмотреть сообщение
Just tested it and it works for me. It looks like you can't return the parameter "string".

Working function for your scenario:
pawn Код:
AddUnderscore(string[])
{
    new manipulated[MAX_PLAYER_NAME];
    for(new i = 0, l = strlen(string); i < l; i++)
    {
        manipulated[i] = string[i];
        if(string[i] == ' ')
        {
            manipulated[i] = '_';
        }
    }
    return manipulated;
}
Btw, why did you add "stock" to the function?
That worked a treat, thanks mate.
Reply


Messages In This Thread
Replace ' ' with '_' - by Jack_Leslie - 04.07.2014, 14:10
AW: Replace ' ' with '_' - by Mellnik - 04.07.2014, 14:12
Re: Replace ' ' with '_' - by Jack_Leslie - 04.07.2014, 14:18
AW: Replace ' ' with '_' - by Mellnik - 04.07.2014, 14:32
Re: Replace ' ' with '_' - by Rittik - 04.07.2014, 14:49
Re: AW: Replace ' ' with '_' - by Jack_Leslie - 05.07.2014, 00:00

Forum Jump:


Users browsing this thread: 1 Guest(s)