更新时间:2022-12-28 16:09:54
此解决方案将每个运算符周围的空格归一化.
This solution normalizes the whitespace around each operator.
return expr.replaceAll("(?<=\\d)\\s*([-+/*])\\s*(?=\\d)", " $1 ");
在字符串中的每个一两个字符后插入空格
如何从字符串列表中的每个字符串中删除最后一个字符
如何在字符串中的每个字符之间添加空格?
在Python中的空格处拆分列表中的每个字符串