Retired
Sum up the random string (retired)
370 of 3,050sunboshan
Description:
Given a random string consisting of numbers, letters, symbols, you need to sum up the numbers in the string.
Note:
- Consecutive integers should be treated as a single number. eg,
2015
should be treated as a single number2015
, NOT four numbers - All the numbers should be treaded as positive integer. eg,
11-14
should be treated as two numbers11
and14
. Same as3.14
, should be treated as two numbers3
and14
- If no number was given in the string, it should return
0
Example:
str = "In 2015, I want to know how much does iPhone 6+ cost?"
The numbers are 2015
, 6
Sum is 2021
.
Strings
Regular Expressions
Fundamentals
Similar Kata:
Stats:
Created | Aug 24, 2015 |
Warriors Trained | 5127 |
Total Skips | 285 |
Total Code Submissions | 13402 |
Total Times Completed | 3050 |
Ruby Completions | 370 |
JavaScript Completions | 1257 |
Python Completions | 1047 |
CoffeeScript Completions | 18 |
Haskell Completions | 140 |
PHP Completions | 292 |
C Completions | 27 |
Total Stars | 68 |
% of votes with a positive feedback rating | 93% of 540 |
Total "Very Satisfied" Votes | 474 |
Total "Somewhat Satisfied" Votes | 57 |
Total "Not Satisfied" Votes | 9 |