countGraphemes method
countGraphemes returns the number of grapheme clusters there are in the given string
Implementation
int countGraphemes(String str) {
int count = 0;
int index = 0;
int brk;
while ((brk = this.nextBreak(str, index)) < str.length) {
index = brk;
count++;
}
if (index < str.length) {
count++;
}
return count;
}