String interpolation: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Added date. | Use this bot. Report bugs. | Suggested by Spinixster | Category:Programming constructs | #UCB_Category 53/70
Line 142:
=== Java ===
{{Main article|Java (programming language)}}
Java 21 does havehad interpolated strings thanksas toa JEPpreview 430.feature Inin [[JShell|jshell]]Java 21 and Java 22. youYou could use the constant STR of [https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/StringTemplate.html java.lang.StringTemplate] directly.<syntaxhighlight lang="java" line="1">
enum Stage{test,qa,prod}
record Deploy(UUID image, Stage stage){}
Line 149:
var deploy=new Deploy(UUID.randomUUID(), Stage.prod)
STR."Installing \{deploy.image()} on Stage \{deploy.stage()} ..."
</syntaxhighlight>
 
It was removed in Java 23 due to security and design issues.<ref>https://docs.oracle.com/en/java/javase/23/migrate/significant-changes-jdk-release.html</ref>
</syntaxhighlight>https://openjdk.org/jeps/430<nowiki/>
 
=== JavaScript ===