Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,9 @@ public static Expression characterLength(StringLikeLiteral first) {
return new IntegerLiteral(first.getValue().codePointCount(0, first.getValue().length()));
}

private static boolean isSeparator(char c) {
if (".$|()[{^?*+\\".indexOf(c) == -1) {
return false;
} else {
return true;
}
private static boolean isAlphabetic(char c) {
Pattern pattern = Pattern.compile("\\p{Alnum}");
return pattern.matcher(String.valueOf(c)).find();
}

/**
Expand All @@ -437,7 +434,7 @@ public static Expression initCap(StringLikeLiteral first) {
boolean capitalizeNext = true;

for (char c : first.getValue().toCharArray()) {
if (Character.isWhitespace(c) || isSeparator(c)) {
if (Character.isWhitespace(c) || !isAlphabetic(c)) {
result.append(c);
capitalizeNext = true; // Next character should be capitalized
} else if (capitalizeNext) {
Expand Down
Loading