tolower
#9

Quote:
Originally Posted by ZiGGi
View Post
Что-то ты лишнего "наоптимизировал", так будет гораздо меньше действий:
PHP Code:
stock
    ucfirst
(string[])
{
    
string[0] = toupper(string[0]);
    const 
dist 'A' 'a';
    for (new 
1len strlen(string), clen; ++i)
    {
        if (
'A' <= string[i] <= 'Z')
            
string[i] -= dist;
    }

Те же два обращения к массиву, но лишь одно вычитание. Вместо двух присвоений и одного вычитания.
Спасибо, помогло.
Reply


Messages In This Thread
tolower - by Johhnyllll - 12.11.2016, 17:04
Re: tolower - by VVWVV - 12.11.2016, 17:26
Re: tolower - by Johhnyllll - 12.11.2016, 17:27
Re: tolower - by VVWVV - 12.11.2016, 17:41
Re: tolower - by Johhnyllll - 12.11.2016, 18:59
Re: tolower - by OKStyle - 13.11.2016, 04:35
Re: tolower - by ZiGGi - 13.11.2016, 04:57
Re: tolower - by Richard_Gere - 13.11.2016, 09:07
Re: tolower - by Johhnyllll - 13.11.2016, 09:14
Re: tolower - by ZiGGi - 13.11.2016, 10:21
Re: tolower - by Richard_Gere - 13.11.2016, 10:30
Re: tolower - by VVWVV - 13.11.2016, 11:03
Re: tolower - by Richard_Gere - 13.11.2016, 11:15
Re: tolower - by ZiGGi - 13.11.2016, 11:16
Re: tolower - by Richard_Gere - 13.11.2016, 11:22
Re: tolower - by VVWVV - 13.11.2016, 11:35
Re: tolower - by Richard_Gere - 13.11.2016, 11:42
Re: tolower - by VVWVV - 13.11.2016, 11:56
Re: tolower - by White_116 - 13.11.2016, 15:20
Re: tolower - by ZiGGi - 13.11.2016, 15:58
Re: tolower - by White_116 - 13.11.2016, 17:16

Forum Jump:


Users browsing this thread: 5 Guest(s)