This question already has answers here:
Check if string is a punctuation character
                                
                                    (6个答案)
                                
                        
                                3年前关闭。
            
                    
是否存在与C99标准函数'ispunct()'相同的等效Java函数?

http://linux.die.net/man/3/ispunct

当且仅当字符是标点符号时,函数才返回true

最佳答案

你可以用

if (Character.toString(myChar).matches("\\p{Punct}")) {

08-06 20:29