Skip to content

Commit d994ac6

Browse files
committed
fix: cleaner regex output
1 parent fc988e1 commit d994ac6

File tree

1 file changed

+6
-1
lines changed
  • generators/src/main/java/com/algolia/codegen/utils

1 file changed

+6
-1
lines changed

generators/src/main/java/com/algolia/codegen/utils/Helpers.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ public static String camelize(String kebabStr) {
4343

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

4954
/**

0 commit comments

Comments
 (0)