Skip to content
Open
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 @@ -735,7 +735,19 @@ public static String formatUriForPropertiesFile(String uri) {
}

public static boolean hasLineBreak(@Nullable String s) {
return s != null && LINE_BREAK.matcher(s).find();
if (s == null) {
return false;
}
// Single-pass scan for Unicode line break characters to avoid regex overhead.
int len = s.length();
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
if (c == '\n' || c == '\r' || c == '\u000B' || c == '\u000C' ||
c == '\u0085' || c == '\u2028' || c == '\u2029') {
return true;
}
}
return false;
}

public static boolean containsWhitespace(String s) {
Expand Down