private static bool CharInCategoryGroup(char ch, UnicodeCategory chcategory, string category, ref int i) {
i++;
int curcat = (short) category[i];
if (curcat > 0) {
// positive case - the character must be in ANY of the categories in the group
bool answer = false;
while (curcat != 0) {
if (!answer) {
--curcat;
if (chcategory == (UnicodeCategory) curcat)
answer = true;
}
i++;
curcat = (short) category[i];
}
return answer;
}
else {
// negative case - the character must be in NONE of the categories in the group
bool answer = true;
while (curcat != 0) {
if (answer) {
//curcat = -curcat;
//--curcat;
curcat = -1 - curcat;
if (chcategory == (UnicodeCategory) curcat)
answer = false;
}
i++;
curcat = (short) category[i];
}
return answer;
}
}