Browse Source

production code refactored

master
Thomas Papendieck 3 years ago
parent
commit
262d70272a
  1. 6
      TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java

6
TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java

@ -6,10 +6,10 @@ import java.util.regex.Pattern;
public class BownlingCalculator {
public int evaluate(String listOfThrows) {
Matcher matcher = Pattern.compile("\\d").matcher(listOfThrows);
int sum =0;
while (matcher.find()) {
sum+=Integer.parseInt(matcher.group());
Matcher singleDigit = Pattern.compile("\\d").matcher(listOfThrows);
while (singleDigit.find()) {
sum+=Integer.parseInt(singleDigit.group());
}
return sum;
}

Loading…
Cancel
Save