EN
Java - equivalent for JavaScript's String charCodeAt() method
2 answers
9 points
I am looking for the best way to achieve JavaScript String
charCodeAt()
method equivalent in Java.
2 answers
4 points
You should use:
xxxxxxxxxx
1
String string = "Hello World!";
2
3
int codePoint = Character.codePointAt(string, 0); // 72
References
0 commentsShow commentsAdd comment
0 points
xxxxxxxxxx
1
const str = "Hello";
2
const asciiCode = str.charCodeAt(0);
3
console.log('ASCII code of H is:', asciiCode)
1 comments
1y
Question was directed for charCodeAt() method equivalent in Java.