Skip to content

Commit fea3d10

Browse files
committed
Update qhelp
1 parent 441c79e commit fea3d10

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

java/ql/src/Performance/StringReplaceAllWithNonRegex.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Use of `String#replaceAll` with a first argument which is not a regular expression
22

3-
Using `String.replaceAll` is less performant than `String.replace` when the first argument is not a regular expression.
3+
Using `String#replaceAll` is less performant than `String#replace` when the first argument is not a regular expression.
44

55
## Overview
66

7-
The underlying implementation of `String.replaceAll` uses `Pattern.compile` and expects a regular expression as its first argument. However in cases where the argument could be represented by just a plain `String` that does not represent an interesting regular expression, a call to `String.replace` may be more performant as it does not need to compile the regular expression.
7+
The underlying implementation of `String#replaceAll` uses `Pattern#compile` and expects a regular expression as its first argument. However in cases where the argument could be represented by just a plain `String` that does not represent an interesting regular expression, a call to `String#replace` may be more performant as it does not need to compile the regular expression.
88

99
## Recommendation
1010

11-
Use `String.replace` instead where a `replaceAll` call uses a trivial string as its first argument.
11+
Use `String#replace` instead where a `replaceAll` call uses a trivial string as its first argument.
1212

1313
## Example
1414

@@ -25,4 +25,4 @@ public class Test {
2525

2626
## References
2727

28-
- [String.replaceAll](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/String.html#replaceAll(java.lang.String,java.lang.String))
28+
- Java SE Documentation: [String.replaceAll](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/String.html#replaceAll(java.lang.String,java.lang.String)).

0 commit comments

Comments
 (0)