Create a program which sums all integers found in a string which is set as a variable in the program (thus, the program doesn't have to handle any input). The integer numbers are separated by non-numericals (anything but 0, 1, 2, 3, ..., 9).
Examples:
e7rde f ,fe 43 jfj 54f4sD
= 7+43+54+4=1085
= 564 545,5445-32JIFk0ddk
= 64+545+5445+32+0=60860ab0
= 0+0 = 0
Extra notes:
- Unicode support is not necessary, but allowed
-n
(wheren
is an integer) is not counted as a negativen
, but as a hyphen followed byn
.
The answer may be printed on the screen (but not required).
Shortest answer (in characters) win.
5a-3
(my code would skip-
if it follows a number immediately, but not if there was a non-number before it). \$\endgroup\$