How do I detect unicode characters in a Java string?

前端 未结 6 1758
不思量自难忘°
不思量自难忘° 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:53

    I'm not sure from your example what you're trying to do - if you're just trying to replace all non-ASCII values with Y, then you could loop through the string looking for codepoints outside of the range 0 to 127, and replace them those code points with Y.

提交回复
热议问题