15.08.2013, 12:44
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:
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:
but it show some errors
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;
}
The second way:
pawn Код:
stock Underscore(name[])
{
for(new i=0; i<strlen(name); i++)
{
if (name[i] == "_") //
{
name[i] = " ";
return name;
}
}
return 1;
}
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) |