有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java从字符串中获取第一个可打印字符

这似乎是一个已经回答过的问题,但我在任何地方都找不到

如何获取Java中的第一个可打印字符

比如说

abcd    //should return "a" - The first printable char is of 1 bytes
😀😀     //should return "😀" - The first printable char is of 4 bytes (2 codepoints)
"😀".length() //2 - I guess thats because of 2 codepoints
☠😀☠     //should return ☠ - The first printable char is of 1 bytes
🇮🇳😀     //should return 🇮🇳 - The first printable char is of 8 bytes (4 codepoints)
🇮🇳abcd   //should return 🇮🇳 - The first printable char is of 8 bytes (4 codepoints)

共 (0) 个答案