public static Boolean isenglish (String str) {
Return Str.matches ("^[a-za-z.,!?] *");
}
public static Boolean Ischinese (String str) {//detection contains Chinese
String regEx = "[\\u4e00-\\u9fa5]+";
Pattern p = pattern.compile (regEx);
Matcher m = p.matcher (str);
if (M.find ()) {
return true;
} else {
return false;
}
}
Static Boolean isnumber (String str)
{
Pattern Pattern=pattern.compile ("-?[ 0-9]*[.]? [0-9]* ");
Matcher Match=pattern.matcher (str);
if (Match.matches () ==false)
{
return false;
}
Else
{
return true;
}
}
}
----------------------------------------------
Extract string in, English, number
--------------------
String str1 = Str.replaceall ("[^\\u4e00-\\u9fa5]", "");
String str2 = Str.replaceall ("[^0-9]", "");
String STR3 = Str.replaceall ("[^a-za-z]", "");
--------------------
Methods of Detection, English and Chinese