Hi,

Your mail is virtually unreadable.

But from what I can gather, I think you are asking for something like this: https://openjdk.java.net/jeps/8273943

However, that is not a question for the build-dev mailing list.

/Magnus



On 2022-03-17 10:15, Ruidong Pu wrote:
This feature has been around for a long time in other languages. Mainly for automatic insertion of values for string formatting, such as template strings in Python3 or JavaScript (maybe with different names).<br/><br/>Below are some examples of template strings.<br/><br/>For example, after Python 3.6+, Python can format strings like this:<br/><br/>&gt;&gt;&gt; name = &quot;Fred&quot;<br/>&gt;&gt;&gt; f&quot;He said his name is {name!r}.&quot;<br/>&quot;He said his name is 'Fred'.&quot;<br/>&gt;&gt;&gt; f&quot;He said his name is {repr(name)}.&quot;  # repr() is equivalent to !r<br/>&quot;He said his name is 'Fred'.&quot;<br/>&gt;&gt;&gt; width = 10<br/>&gt;&gt;&gt; precision = 4<br/>&gt;&gt;&gt; value = 
decimal.Decimal(&quot;12.34567&quot;)<br/>&gt;&gt;&gt; f&quot;result: {value:{width}.{precision}}&quot;  # nested fields<br/>'result:      12.35'<br/>&gt;&gt;&gt; today = datetime(year=2017, month=1, day=27)<br/>&gt;&gt;&gt; f&quot;{today:%B %d, %Y}&quot;  # using date format specifier<br/>'January 27, 2017'<br/>&gt;&gt;&gt; f&quot;{today=:%B %d, %Y}&quot; # using date format specifier and debugging<br/>'today=January 27, 2017'<br/>&gt;&gt;&gt; number = 1024<br/>&gt;&gt;&gt; f&quot;{number:#0x}&quot;  # using integer format specifier<br/>'0x400'<br/>&gt;&gt;&gt; foo = &quot;bar&quot;<br/>&gt;&gt;&gt; f&quot;{ foo = }&quot; # preserves whitespace<br/>&quot; foo = 'bar'&quot;<br/>&gt;&gt;&gt; line = 
&quot;The mill's closed&quot;<br/>&gt;&gt;&gt; f&quot;{line = }&quot;<br/>'line = &quot;The mill\'s closed&quot;'<br/>&gt;&gt;&gt; f&quot;{line = :20}&quot;<br/>&quot;line = The mill's closed   &quot;<br/>&gt;&gt;&gt; f&quot;{line = !r:20}&quot;<br/>'line = &quot;The mill\'s closed&quot; '<br/><br/>output {}:<br/><br/>&gt;&gt;&gt; f&quot;Out: {{0}}&quot;<br/><br/>Multi-line text:<br/><br/>count=1<br/>out=f&quot;&quot;&quot;<br/>Count is: {count}<br/>Count is: {count}<br/>Count is: {count}<br/>&quot;&quot;&quot;<br/><br/>example from: <a 
href="https://docs.python.org/3/reference/lexical_analysis.html#f-strings";>https://docs.python.org/3/reference/lexical_analysis.html#f-strings</a><br/><br/>JavaScript:<br/><br/>Template strings also exist in JavaScript, e.g.:<br/><br/>// Untagged, these create strings:<br/>`string text`<br/><br/>`string text line 1<br/> string text line 2`<br/><br/>let expression=&quot;,&quot;;<br/><br/>`string text ${expression} string text`<br/><br/>Reference address: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals";>https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals</a><br/><br/>If you want Java to optimize the way of formatting strings in Text Blocks, you can refer to the implementation of Python or 
JavaScript.<br/><br/><html>
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

</body>
</html>

Reply via email to