- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The codePoints() method in Java IntStream
The codePoint() method is used to display a stream of code point values from the given sequence.
The syntax is as follows
IntStream codePoints()
To work with Java IntStream class, you need to import the following package
import java.util.stream.IntStream;
Here is our string
String myStr = "Example!";
Now, get the code point values
IntStream intStream = myStr.codePoints();
The following is an example to implement codePoints() method in Java IntStream
Example
import java.util.stream.IntStream; public class Demo { public static void main(String args[]) { String myStr = "Example!"; IntStream intStream = myStr.codePoints(); System.out.println("The following is the list of ASCII Values for the given string = "); intStream.forEach(System.out::println); } }
Output
The following is the list of ASCII Values for the given string = 69 120 97 109 112 108 101 33
Advertisements