how check if String has Full width character in java

后端 未结 4 1638
失恋的感觉
失恋的感觉 2021-01-12 16:48

Can anyone suggest me how to check if a String contains full width characters in Java? Characters having full width are special characters.

4条回答
  •  一生所求
    2021-01-12 17:24

    use regular expression here. \W is used to check for non-word characters.

    str will contain full width character if following statement return true:

    boolean flag = str.matches("\\W");

提交回复
热议问题