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
4 ответов
+ 2
Thanks a lot for interest 🙂
+ 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>
}
}