id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

tmhscs@gmail.com strings > string_sumNumbers
prev  |  next  |  chance

Given a String called "str", return the integer sum of all of the numbers that exist in the String. If the String contains no numbers, then return zero. Beware, a number can be multiple digits, but ends if there is a non-digit separating it.


string_sumNumbers("100 plus 200") → 300
string_sumNumbers("a100b200c300d") → 600
string_sumNumbers("Room 1525") → 1525

...Save, Compile, Run (ctrl-enter)

public int string_sumNumbers(String text) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy