Java .codePointBefore()
Published Jul 23, 2021Updated Sep 3, 2021
Contribute to Docs
Returns the Unicode value before the given index in the string.
Syntax
string.codePointBefore(index)
index(required): Anintvalue that represents the Unicode value you want to retrieve for the element before the given index.
Example 1
Print the Unicode value of the first character, "H" at the first index:
class FirstCharacterUnicodeValue {public static void main(String[] args) {String greeting = "Hello World";System.out.println(greeting.codePointBefore(1));// Output: 72}}
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Java on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn to code in Java — a robust programming language used to create software, web and mobile apps, and more.
- Beginner Friendly.17 hours