Last active
July 24, 2024 22:18
-
-
Save obfusk/beeaeb1372ce5c447a5b5e6eee5f8201 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ java Unicode.java | |
55356 | |
57331 | |
65039 | |
8205 | |
9895 | |
65039 | |
--- | |
127987 | |
65039 | |
8205 | |
9895 | |
65039 | |
--- | |
127987 | |
65039 | |
8205 | |
9895 | |
65039 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Unicode { | |
public static void main(String[] args) { | |
String foo = "🏳️⚧️"; | |
for (String x : foo.split("")) { | |
System.out.println(x.codePointAt(0)); | |
} | |
System.out.println("---"); | |
int n = foo.codePointCount(0, foo.length()); | |
for (int i = 0; i < n; ++i) { | |
int j = foo.offsetByCodePoints(0, i); | |
System.out.println(foo.codePointAt(j)); | |
} | |
System.out.println("---"); | |
for (int c : foo.codePoints().toArray()) { | |
System.out.println(c); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment