java 如何打印字符串中的中文

读写代码实现把字符串"case when 条件 1 in (‘城区厅,乡镇厅’)" 中的中文打印出来

public static void main(String[] args) {
    String str = "case when 条件 1 in (‘城区厅,乡镇厅’)";
    String reg = "[\\u4e00-\\u9fa5]";
    Pattern pattern = Pattern.compile(reg);
    Matcher matcher = pattern.matcher(str);
    while(matcher.find()){
        System.out.print(matcher.group());
    }
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-08-04
你这是sql 啊,用java实现的话,jdbc,hibernate都可以弄,感觉你就是简单的获取中文字符串,就用jdbc吧。。。

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网