ITeye博客

JAVA去空格

小色帝 · 2012-12-20 16:53 · JAVA · Web前端 · Markdown

String ccc=” he l l o , w o r l d “; System.err.println(“去左边空格:”+ccc.replaceAll(“^\s*”, “”)+”————”); System.err.println(“去右边空格:”+ccc.replaceAll(“\s*$”, “”)+”————”); System.err.println(“去所有空格:”+ccc.replaceAll(“\s”, “”)+”————”); System.err.println(“去两端空格:”+ccc.replaceAll(“^\s*(.?)\s$”,”$1″)+”————”);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。