0

How can solved that problem another way?

I want to sum number of digits from user's entry https://code.sololearn.com/cVCAlqGk0Liq/?ref=app

18th Dec 2021, 1:42 PM
ilker
4 Réponses
+ 2
Thanks a lot for interest 🙂
18th Dec 2021, 2:17 PM
ilker
+ 2
If you use String and want to process only the digits, then you can verify whether a particular character was a digit ( '0' ~ '9' ), by using Character.isDigit() method in `if` conditional inside your loop for( ... ) { if( Character.isDigit( number.charAt( i ) ) { // add this to <sum> } }
18th Dec 2021, 2:32 PM
Ipang