Skip to content

Commit

Permalink
dbeaver/pro#3893 extract whitespace pattern to common utils (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
n5a5 authored Dec 30, 2024
1 parent 7b6bd39 commit bc3c2e6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
* Common utils
*/
public class CommonUtils {
/**
* A pattern that matches one or more whitespace characters.
*/
public static final Pattern WHITESPACE_PATTERN = Pattern.compile("\\s+");

public static final char PARAGRAPH_CHAR = (char) 182;

Expand Down Expand Up @@ -873,7 +877,7 @@ public static String trim(String str) {
}

public static String compactWhiteSpaces(String str) {
return str.replaceAll("\\s+", " ");
return WHITESPACE_PATTERN.matcher(str).replaceAll(" ");
}

public static String getSingleLineString(String displayString) {
Expand Down

0 comments on commit bc3c2e6

Please sign in to comment.