예제 #1
0
파일: tools.cpp 프로젝트: 081421/otxserver
std::string ucfirst(std::string source)
{
	for(uint16_t i = 0; i < (uint16_t)source.length(); ++i)
	{
		if(source[i] != ' ')
		{
			source[i] = upchar(source[i]);
			break;
		}
	}

	return source;
}
예제 #2
0
파일: tools.cpp 프로젝트: 081421/otxserver
std::string ucwords(std::string source)
{
	bool tmp = true;
	for(uint16_t i = 0; i < (uint16_t)source.length(); ++i)
	{
		if(source[i] == ' ')
			tmp = true;
		else if(tmp)
		{
			source[i] = upchar(source[i]);
			tmp = false;
		}
	}

	return source;
}
예제 #3
0
파일: tools.cpp 프로젝트: divinity76/YurOTS
std::string article(const std::string& name)
{
	if (name.empty())
		return name;

	switch (upchar(name[0]))
	{
	case 'A':
	case 'E':
	case 'I':
	case 'O':
	case 'U':
		return std::string("an ") + name;
	default:
		return std::string("a ") + name;
	}
}
예제 #4
0
파일: tools.cpp 프로젝트: divinity76/YurOTS
//////////////////////////////////////////////////
// Upcase a 0-terminated string, but at most n chars.
void upper(char *upstr, char *str, int n) {
    for (; *str && n; str++, upstr++, n--)
        *upstr = upchar(*str);
    if (n) *upstr = '\0';
}
예제 #5
0
파일: tools.cpp 프로젝트: divinity76/YurOTS
//////////////////////////////////////////////////
// Upcase a 0-terminated string.
void upper(char *upstr, char *str) {
    for (; *str; str++, upstr++)
        *upstr = upchar(*str);
    *upstr = '\0';
}