1. 程式人生 > 其它 >Java去除字串中包含的中文

Java去除字串中包含的中文

技術標籤:Java

一、程式碼示例:

public class Test {
	String REGEX_CHINESE = "[\u4e00-\u9fa5]";// 中文正則
	public static  void main(String[] args) throws Exception {
		 String ssss = "1分鐘3333";
		 String strs = ssss.replaceAll(REGEX_CHINESE, "");
		 System.out.println("strs:"+strs);
	}
}

二、執行main方法所得如下圖:
在這裡插入圖片描述