strings: Java Strings deep dive companion code (pool/intern, indy concat vs StringBuilder JMH, text blocks, string templates)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KqJyCidz3ZgRyHABv2GVJh
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
--- closing delimiter on its own line, aligned with the text ---
|
||||
{\n
|
||||
.."id":.1\n
|
||||
}\n
|
||||
|
||||
--- closing delimiter right after the last line (no final newline) ---
|
||||
{\n
|
||||
.."id":.1\n
|
||||
}
|
||||
--- closing delimiter 2 columns left of the text: 2 spaces of indentation survive ---
|
||||
..left\n
|
||||
|
||||
--- trailing spaces are stripped, but \s and \040 survive ---
|
||||
x....\n
|
||||
y.\n
|
||||
|
||||
--- backslash at end of line joins the lines ---
|
||||
one.line\n
|
||||
|
||||
--- escapes are processed after indentation is stripped ---
|
||||
tab: |\n
|
||||
|
||||
--- double quotes need no escape; only a run of three does ---
|
||||
say."hi".and."""\n
|
||||
|
||||
two identical text blocks are the same pooled instance: true
|
||||
equals the hand-written literal: true
|
||||
--- formatted() is the built-in way to interpolate ---
|
||||
Hello,.Ann!.You.are.30.\n
|
||||
|
||||
Reference in New Issue
Block a user