(1)匹配一个或多个空格的正则表达式:\\s+
String[] newStr = str.trim().split("\\s+");
(2)匹配二个或多个空格的正则表达式:\\s{2,}
String str = new String("I am a good boy! ");
String newStr = str.replaceAll("\\s{2,}", " ").trim();
$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131(1)匹配一个或多个空格的正则表达式:\\s+
String[] newStr = str.trim().split("\\s+");
(2)匹配二个或多个空格的正则表达式:\\s{2,}
String str = new String("I am a good boy! ");
String newStr = str.replaceAll("\\s{2,}", " ").trim();