Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbeaver/pro#3893 extract whitespace pattern to common utils #65

Merged
merged 1 commit into from
Dec 30, 2024
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
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 @@ -872,11 +876,11 @@
return str == null ? null : str.trim();
}

public static String compactWhiteSpaces(String str) {

Check warning on line 879 in modules/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java

View workflow job for this annotation

GitHub Actions / Check / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./modules/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java:879:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return str.replaceAll("\\s+", " ");
return WHITESPACE_PATTERN.matcher(str).replaceAll(" ");
}

public static String getSingleLineString(String displayString) {

Check warning on line 883 in modules/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java

View workflow job for this annotation

GitHub Actions / Check / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./modules/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java:883:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return displayString
.replace('\n', PARAGRAPH_CHAR)
.replace("\r", "")
Expand Down
Loading