Example usage for java.lang CharSequence chars

List of usage examples for java.lang CharSequence chars

Introduction

In this page you can find the example usage for java.lang CharSequence chars.

Prototype

public default IntStream chars() 

Source Link

Document

Returns a stream of int zero-extending the char values from this sequence.

Usage

From source file:com.qwazr.utils.StringUtils.java

public static boolean anyDigit(CharSequence chars) {
    if (chars == null)
        return false;
    return chars.chars().anyMatch(new IntPredicate() {
        @Override/*w  ww . j av  a 2  s. c  o  m*/
        public boolean test(int value) {
            return Character.isDigit(value);
        }
    });
}

From source file:com.qwazr.utils.StringUtils.java

public static boolean anyAlpha(CharSequence chars) {
    if (chars == null)
        return false;
    return chars.chars().anyMatch(new IntPredicate() {
        @Override/*from  w w w .  ja  v  a 2  s . c o m*/
        public boolean test(int value) {
            return Character.isAlphabetic(value);
        }
    });
}