源代码下载地址:http://www.zuidaima.com/share/1550463517428736.htm
package com.zuidaima.util; /** *@author www.zuidaima.com **/ public class test { public static void main(String[] args) { String a = "中国China"; for (int i=a.length(); --i>=0;) { String b = a.substring(i, i+1); boolean c = java.util.regex.Pattern.matches("[\u4E00-\u9FA5]", b); if(c) { System.out.println("此字符串包含中文"); break; } } } }
时间: 2024-12-25 12:18:03