一行文字开头的空格替换的正则方法
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
String str = " 酷 流行";
System.out.println(str.replaceAll("(?m)(?<=^ *) ", " "));
替换结果
酷 流行
发布时间: 2012-10-29 10:03:53 作者: rapoo
一行文字开头的空格替换的正则方法
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
String str = " 酷 流行";
System.out.println(str.replaceAll("(?m)(?<=^ *) ", " "));
替换结果
酷 流行