Skip to content

Use single quotes for backslashes in StringConcatToTextBlock.md #5030

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 3 additions & 3 deletions docs/bugpattern/StringConcatToTextBlock.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ String message =

## Trailing newlines

If the string should not contain a trailing newline, use a `\ ` to escape the
If the string should not contain a trailing newline, use a '\' to escape the
final newline in the text block. That is, these two strings are equivalent:

```java
Expand All @@ -46,11 +46,11 @@ String s =

The suggested fixes for this check preserve the exact contents of the original
string, so if the original string doesn't include a trailing newline the fix
will use a `\ ` to escape the last newline.
will use a '\' to escape the last newline.

If the whitespace in the string isn't significant, for example because the
string value will be parsed by a parser that doesn't care about the trailing
newlines, consider removing the final `\ ` to improve the readability of the
newlines, consider removing the final '\' to improve the readability of the
string.

[text blocks]: https://docs.oracle.com/en/java/javase/23/text-blocks/index.html