Reputation: 93
I want to manually check each character of a string
for whether it contains any full width characters. Can someone help me?
This is what I have so far:
public boolean areAnyFullWidth(String input) {
for (char c : input.toCharArray())
if ((c & 0xff00) == 0xff00)
return true;
return false;
}
Upvotes: 0
Views: 1213
Reputation: 16284
If you know the start and end unicode full width range then things are very simple.
Say the range is 0xFFOO to 0xFFEF:
public boolean areAnyFullWidth(String input) {
for(char c : input.toCharArray())
if(c >= 0xFFOO && c <= 0xFFEF)
return true;
return false;
}
Upvotes: 1