日期:2014-05-20 浏览次数:20664 次
Pattern pattern=Pattern.compile("[零一二三四五六七八九十百千万亿]+|[零壹贰叁肆伍陆柒捌玖拾佰仟万亿]+|[\\d]+"); Matcher matcher=pattern.matcher("一千八百四十二"); System.out.println(matcher.matches()); matcher=pattern.matcher("壹仟贰佰"); System.out.println(matcher.matches()); matcher=pattern.matcher("15687"); System.out.println(matcher.matches()); matcher=pattern.matcher("一23"); System.out.println(matcher.matches()); matcher=pattern.matcher("四万万五千"); System.out.println(matcher.matches());