在 Java 中,可以使用正则表达式来判断字符串中是否含有标点符号。
例如,如果你想判断字符串中是否包含逗号,可以使用如下代码:
String str= "hello, world";
boolean hasComma = str.matches(".*,[^\\s]*");
在 Java 中,可以使用正则表达式来判断字符串中是否含有标点符号。
例如,如果你想判断字符串中是否包含逗号,可以使用如下代码:
String str= "hello, world";
boolean hasComma = str.matches(".*,[^\\s]*");