[Java] to determine whether it is Chinese or Chinese punctuation

 

1  / * 
2  * is determined whether the character is a Chinese, Chinese can check whether punctuation
 . 3  *
 . 4  * @param STR characters to be calibrated
 . 5  * @return whether Chinese
 . 6   * / 
. 7  public  static  Boolean isContainChinese ( char STR) {
 8      // characters 
. 9      the Pattern of Pattern.compile P = ( "[\ u4e00- \ u9fa5]" );
 10      Matcher m = p.matcher (String.valueOf (STR));
 . 11      IF (m.find ()) {
 12 is          return  to true ;
 13 is      }
 14  
15     // Chinese punctuation 
16      the p-Pattern.compile = ( "[\ uFF01] | [\ uFF0C- \ uFF0E] | [\ uFF1A- \ uFF1B] | [\ uFF1F] | [\ uFF08- \ uFF09] | [\ u3001 - \ u3002] | [\ u3010- \ u3011] | [\ u201C- \ u201D] | [\ u2013- \ u2014] | [\ u2018- \ u2019] | [\ u2026] | [\ u3008- \ u300F] | [\ u3014- \ u3015] " );
 . 17      m = p.matcher (String.valueOf (STR));
 18 is      return m.find ();
 . 19 }

 

Reference article: https://www.cnblogs.com/qinxu/p/8619082.html

                  https://blog.csdn.net/COCO56/article/details/87618925

Guess you like

Origin www.cnblogs.com/xiaostudy/p/12658451.html