Question: Write a loop that counts the number of digits that appear in the string object str Can some include this loop in a program int
Write a loop that counts the number of digits that appear in the string object str
Can some include this loop in a program
int count = 0;
for(int I = 0; I < str.length(); i++) {
if (Character.isDigit(str.charAt(i)))
count++;
}
Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
