Add test showing correct usage

This commit is contained in:
Owen Mansel-Chan
2025-05-22 14:30:32 +01:00
parent 4c818c00f3
commit 79453cc103
2 changed files with 2 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ public class Test {
String s1 = "test";
s1 = s1.replaceAll("t", "x"); // NON_COMPLIANT
s1 = s1.replaceAll(".*", "x"); // COMPLIANT
s1 = s1.replace("t", "x"); // COMPLIANT
}
}

View File

@@ -3,5 +3,6 @@ public class Test {
String s1 = "test";
s1 = s1.replaceAll("t", "x"); // $ Alert // NON_COMPLIANT
s1 = s1.replaceAll(".*", "x"); // COMPLIANT
s1 = s1.replace("t", "x"); // COMPLIANT
}
}