<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"David Alayachew" <davidalayachew@gmail.com><br><b>To: </b>"Remi Forax" <forax@univ-mlv.fr><br><b>Cc: </b>"amber-dev" <amber-dev@openjdk.org><br><b>Sent: </b>Monday, October 23, 2023 3:01:32 PM<br><b>Subject: </b>Re: Silly and likely non-important question about StringTemplates.<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hello Rémi,</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Thank you for your response!</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">I am making a SWING_HTML String Template Processor that turns basic multi-line strings into ones that are <html> enclosed, and replace new lines with <br>. So, for me, most of my Strings are already made, and thus, don't need to have anything "inserted" into them.</div><div class="gmail_default" style="font-family:monospace"><br>   private static final Processor<String, RuntimeException> SWING_HTML =<br>      st -><br>         "<html>"<br>         +<br>         st<br>            .interpolate()<br>            .lines()<br>            .collect(java.util.stream.Collectors.joining("<br>"))<br>         +<br>         "</html>"<br>         ;</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">It would be nice if Java put this particular processor into the Swing library itself at some point. But it's easy enough for me to implement myself, which is a nice thing about String Templates. Plus, this feature composes -- I can make an italics or bold processor that can translate to the various html tags that Swing supports. And it's safer than just putting in the tags myself because the curly braces will turn into compiler errors if I don't align them correctly. Plus, curly braces are a syntax feature, so most ide's (even VIM and EMACS!) will give you hints about where your curly braces are, making it much easier to trace issues with this.<br></div></div></blockquote><div><br></div><div>Hello,<br data-mce-bogus="1"></div><div>don't forget to escape <, > et & correctly.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">Thank you for your time and help!</div><div class="gmail_default" style="font-family:monospace">David Alayachew</div></div></blockquote><div><br></div><div>regards,<br data-mce-bogus="1"></div><div>Rémi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div class="gmail_default" style="font-family:monospace"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 23, 2023 at 1:06 AM Remi Forax <<a href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br><br><hr id="m_-6269725444836113259zwchr"><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From: </b>"David Alayachew" <<a href="mailto:davidalayachew@gmail.com" target="_blank">davidalayachew@gmail.com</a>><br><b>To: </b>"amber-dev" <<a href="mailto:amber-dev@openjdk.org" target="_blank">amber-dev@openjdk.org</a>><br><b>Sent: </b>Monday, October 23, 2023 6:35:00 AM<br><b>Subject: </b>Silly and likely non-important question about StringTemplates.<br></blockquote></div><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hello Amber Dev Team,</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">I've been playing with StringTemplates a bit more, and I had a quick question.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">I repeatedly find myself in the same situation -- I have a String that is already in a variable, and I want it to be the full String in the StringTemplate. What is the recommended way to do it?</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">For example.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">String abc = "xyz";</div><div class="gmail_default" style="font-family:monospace">MY_PROCESSOR. <--- what goes here?</div></div></blockquote><br><div>MY_PROCESSOR."\{abc}"<br></div><br><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div dir="ltr"><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Thank you for your time!</div><div class="gmail_default" style="font-family:monospace">David Alayachew</div></div></blockquote><br><div>regards,<br></div><div>Rémi<br></div></div></div></div></blockquote></div><br></blockquote></div></div></body></html>