Editing one special symbol
#1

Hey,

I'd like to know how to change a symbol in a string?

Example:

I got the username Firstname_Lastname. How can I change the underscore (_) to a space symbol ( )?
Reply
#2

This might help you

pawn Код:
stock RemoveUnderScore(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}

public OnPlayerText(playerid,text[])
{
    new string[128];
    format(string,sizeof(string),"%s: %s",RemoveUnderScore(playerid),text);
    SendClientMessageToAll(color,string);
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)