Java String character extraction via char Stream

Description

Java String character extraction via char Stream

public class Main {
  public static void main(String[] args) {
    String str = "demo 2s.com 5 test,123,CSS,1,HTML, 2";
    str.chars()//from   www. ja v a2s. c  om
    .filter(n ->  !Character.isDigit((char)n) &&   !Character.isWhitespace((char)n))
    .forEach(n ->  System.out.print((char)n));

  }
}



PreviousNext

Related