String Question 8

Home / Java Practice Question / String Question 8

String Question 8


Question 18. Write a Program to count camel case characters in string.

Program



class Sol

{

    int countCamelCase (String s)

    {

        int count = 0;

        for (int i = 0; i < s.length(); i++) {

            char ch = s.charAt(i);

            if (ch > 64 && ch < 91) count++;

        }

        return count;

    }

}