24.08.2016, 19:56
Nem todos os caracteres maiъsculos sгo convertidos em minъsculos. Isto irб resolver nos demais casos, e uma outra funзгo jб para converter uma string inteira.
Exemplos de uso
PHP Code:
// de maiъscula para minъscula
stock new_tolower(c) {
switch(c) {
case 'Т': return 'т';
case 'Х': return 'х';
case 'У': return 'у';
case 'Г': return 'г';
case 'Б': return 'б';
case 'А': return 'а';
case 'З': return 'з';
case 'Ъ': return 'ъ';
case 'Щ': return 'щ';
case 'Ф': return 'ф';
case 'Ы': return 'ы';
case 'К': return 'к';
case 'Й': return 'й';
case 'И': return 'и';
case 'М': return 'м';
case 'Н': return 'н';
case 'В': return 'в';
case 'С': return 'с';
case 'О': return 'о';
}
return tolower(c);
}
stock convert_minusculas(string[]) {
for(new i; i < strlen(string); i++)
string[i] = new_tolower(string[i]);
return string;
}
// de minъscula para maiъscula
stock new_toupper(c) {
switch(c) {
case 'у': return 'У';
case 'т': return 'Т';
case 'х': return 'Х';
case 'ф': return 'Ф';
case 'г': return 'Г';
case 'б': return 'Б';
case 'а': return 'А';
case 'в': return 'В';
case 'з': return 'З';
case 'ъ': return 'Ъ';
case 'щ': return 'Щ';
case 'ы': return 'Ы';
case 'к': return 'К';
case 'й': return 'Й';
case 'и': return 'И';
case 'о': return 'О';
case 'н': return 'Н';
case 'м': return 'М';
case 'с': return 'С';
}
return toupper(c);
}
stock convert_maiusculas(string[]) {
for(new i; i < strlen(string); i++)
string[i] = new_toupper(string[i]);
return string;
}
PHP Code:
public OnPlayerText(playerid, text[]) {
static Name[24], Msg[144];
GetPlayerName(playerid, Name, 24);
format(Msg, 144, "%s [%i]: %s", Name, playerid, convert_minusculas(text)); // convertendo todo o texto para minusculo
SendClientMessageToAll(GetPlayerColor(playerid), Msg);
return 0;
}