How do I detect unicode characters in a Java string?

前端 未结 6 1763
不思量自难忘°
不思量自难忘° 2020-12-03 10:28

Suppose I have a string that contains Ü. How would I find all those unicode characters? Should I test for their code? How would I do that?

For example, given the str

6条回答
  •  一整个雨季
    2020-12-03 10:50

    You could loop through your string and for every character call

    If (Character.UnicodeBlock.of(c) != Character.UnicodeBlock.BASIC_LATIN) {
     // replace with Y
    }
    

提交回复
热议问题