2020-04-13

Java String chars() method

Java String chars() method


String chars() method added jdk 9.

This method returns a stream of int zero-extending the char values from this sequence. Any char which maps to a surrogate code point is passed through uninterpreted.

Java Program Example:


class StringChars{
public static void main(String args[]){
String str = "This is a String";
IntStream ins = str.chars().....// process with inStream api

}
}

No comments:

Post a Comment