Skip to content

Commit

Permalink
fix: cleaner regex output
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Oct 28, 2024
1 parent fc988e1 commit d994ac6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public static String camelize(String kebabStr) {

// convert camelCase77String to CAMEL_CASE_77_STRING
public static String toScreamingSnakeCase(String camelCase) {
return camelCase.replaceAll("-", "_").replaceAll("(.+?)([A-Z]|[0-9])", "$1_$2").toUpperCase(Locale.ROOT);
return camelCase
.replaceAll("-", "_")
.replaceAll("/", "_")
.replaceAll("(?<=.)([A-Z]+|\\d+)", "_$1")
.replaceAll("__", "_")
.toUpperCase(Locale.ROOT);
}

/**
Expand Down

0 comments on commit d994ac6

Please sign in to comment.