Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isAddress(String address) { int i = 0, j = 0, k = 0, u = 0; int count = address.length(); Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5]"); Matcher m = pattern.matcher(address); while (m.find()) { i++; } for (int idx = 0; idx < count; idx++) { char c = address.charAt(idx); int tmp = (int) c; if ((tmp >= 'a' && tmp <= 'z') || (tmp >= 'A' && tmp <= 'Z')) { j++; } if (Character.isDigit(address.charAt(idx))) { k++; } if (c == ' ') { u++; } } if ((i + j + k + u) == count) { return true; } else { return false; } } }