13.11.2016, 04:57
Quote:
Да. Вот:
Code:
stock ucfirst(string[]) { string[0] = toupper(string[0]); const dist = 'A' - 'a'; for(new i = 1, len = strlen(string), c; i < len; ++i) { if ('A' <= (c = string[i]) <= 'Z') c -= dist; string[i] = c; } } |
PHP Code:
stock
ucfirst(string[])
{
string[0] = toupper(string[0]);
const dist = 'A' - 'a';
for (new i = 1, len = strlen(string), c; i < len; ++i)
{
if ('A' <= string[i] <= 'Z')
string[i] -= dist;
}
}