tolower
#17

Quote:
Originally Posted by VVWVV
View Post
Вот функция дружит с упакованными строками и русским алфавитом:
Code:
stock
	ucfirst(string[])
{
	const dist = \'A\' - \'a\';
	new i = strlen(string),
		c;
	if (string{0} != 0)
	{
		if (0xE0 <= (c = string{0}) <= 0xFF)
			string{0} += dist;
		else if (\'a\' <= c <= \'z\')
			string{0} += dist;
		do
		{
			if (0xC0 <= (c = string{i}) <= 0xDF)
				c -= dist;
			else if (\'A\' <= c <= \'Z\')
				c -= dist;
			string{i} = c;
		}
		while (--i != 0);
	}
	else
	{
		if (0xE0 <= (c = string[0]) <= 0xFF)
			string[0] += dist;
		else if (\'a\' <= c <= \'z\')
			string[0] += dist;
		do
		{
			if (0xC0 <= (c = string[i]) <= 0xDF)
				c -= dist;
			else if (\'A\' <= c <= \'Z\')
				c -= dist;
			string[i] = c;
		}
		while (--i != 0);
	}
}
Забыл букву \'Ё\'. символы
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: 6 Guest(s)