字符串中数字和汉字之前打空格
public static void main(String[] args) { String regex = "(?<=[\\u4e00-\\u9fa5A-Za-z])(?=[0-9])|(?<=[0-9])(?=[\\u4e00-\\u9fa5A-Za-z])"; String input = "大床1.8米"; String result = input.replaceAll( regex, " " ); System.out.println(result); }
大床 1.8 米
无为而治