Lambda表达式计算字符串中小写字母个数

public static void main(String[] args) {

        String str ="a1b2c3d4e5f6d7*ABCDf";
        IntStream chars = str.chars();
        int reduce = (int) chars.filter(Character::isLowerCase).count();
        System.out.println(reduce);
    }

猜你喜欢

转载自blog.csdn.net/java_huilong/article/details/80006116