Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/gradle/develop/io.sentry-sentr…
Browse files Browse the repository at this point in the history
…y-1.7.28
  • Loading branch information
Phergus authored Oct 25, 2019
2 parents c7b1e4d + 404f98f commit f7ee430
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private StringFunctions() {
"decode",
"startsWith",
"endsWith",
"titleCase");
"capitalize");
}

public static StringFunctions getInstance() {
Expand Down Expand Up @@ -388,26 +388,26 @@ public Object childEvaluate(Parser parser, String functionName, List<Object> par
? BigDecimal.ONE
: BigDecimal.ZERO;
}
if (functionName.equals("titleCase")) {
if (functionName.equals("capitalize")) {
if (parameters.size() < 1) {
throw new ParserException(
I18N.getText(
"macro.function.general.notEnoughParam", functionName, 1, parameters.size()));
}
return titleCase(parameters.get(0).toString());
return capitalize(parameters.get(0).toString());
}
// should never happen
throw new ParserException(functionName + "(): Unknown function.");
}

/**
* This method returns a version of the passed in string where all the first letters of words are
* uppercase.
* title case.
*
* @param str The string converted to title case.
* @return The string converted to title case.
*/
private String titleCase(String str) {
private String capitalize(String str) {
Pattern pattern = Pattern.compile("(\\p{IsAlphabetic}+)");
Matcher matcher = pattern.matcher(str);

Expand Down

0 comments on commit f7ee430

Please sign in to comment.