(Sonar) Fix "String#replace should be preferred to String#replaceAll" (#1056)

Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
This commit is contained in:
pixeebot[bot] 2024-04-09 06:52:52 +01:00 committed by GitHub
parent 66d5f3e4b5
commit 5564f378e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -185,7 +185,7 @@ public class GeneralUtils {
// Insert multiplication between a number and 'n' (e.g., "4n" becomes "4*n") // Insert multiplication between a number and 'n' (e.g., "4n" becomes "4*n")
String withMultiplication = expression.replaceAll("(\\d)n", "$1*n"); String withMultiplication = expression.replaceAll("(\\d)n", "$1*n");
// Now replace 'n' with its current value // Now replace 'n' with its current value
return withMultiplication.replaceAll("n", String.valueOf(nValue)); return withMultiplication.replace("n", String.valueOf(nValue));
} }
private static List<Integer> handlePart(String part, int totalPages, int offset) { private static List<Integer> handlePart(String part, int totalPages, int offset) {