How to find the first Chinese character in a java string -


how find first chinese character in java string example:

string str = "xing 杨某某"; 

how can index of first chinese character 杨 in above str. thanks!

this help:

public static int firstchinesechar(string s) {     (int = 0; < s.length(); ) {         int index = i;         int codepoint = s.codepointat(i);         += character.charcount(codepoint);         if (character.unicodescript.of(codepoint) == character.unicodescript.han) {             return index;         }     }     return -1; } 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -