示例#1
0
bool skipWhitespaceKernel(const void* in_pUnicodeCodePoint, const void* in_pUserdata)
{
	UnicodeCodePoint *pUnicodeCodePoint = (UnicodeCodePoint*) in_pUnicodeCodePoint;

	assert(pUnicodeCodePoint != NULL);

	if (pUnicodeCodePoint != NULL)
		return isSpaceCharacter(*pUnicodeCodePoint);
	else
		return false;
}
示例#2
0
//convert upper-case characters to lower-case characters and removes punctations/space in the front and end
//returns false if cleared string is empty
bool FeatureSet::cleanString(string& str)
{
	uint i, j;
	for (i = 0; (i < str.length()) && (isPunctationCharacter(str[i]) || isSpaceCharacter(str[i])); i++);

	if (i == str.length())
	{
		str = "";
		return false;
	}
	for (j = str.length() - 1; (j > i) && (isPunctationCharacter(str[j]) || isSpaceCharacter(str[j])); j--);

	str = str.substr(i, j - i + 1); //removes punctations in the front and end

	//convert upper-case characters to lower-case characters
	for (uint k = 0; k < str.length(); k++)
	{
		if (str[k] >= 'A' && str[k] <= 'Z')
		{
			str[k] = str[k] + ('a' - 'A');
		}
	}
	return true;
}