Skip to content

Commit

Permalink
Update JavaCamelCaseToSnakeCaseExample.java
Browse files Browse the repository at this point in the history
  • Loading branch information
evrentan committed Dec 2, 2022
1 parent efb9d47 commit 74de7e5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public static void main(String[] args) {
}

public String camelToUnderscore(String input) {
if (input == null) {
if (input.isBlank())
return "";
}

String regex = "([a-z])([A-Z])";
String replacement = "$1_$2";
String result = input.replaceAll(regex, replacement).toLowerCase();
Expand Down

0 comments on commit 74de7e5

Please sign in to comment.