{"id":1161,"date":"2020-04-06T12:32:04","date_gmt":"2020-04-06T00:32:04","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1161"},"modified":"2020-04-06T12:38:39","modified_gmt":"2020-04-06T00:38:39","slug":"string-interpolation","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1161","title":{"rendered":"String Interpolation"},"content":{"rendered":"<p>A <strong>double quoted<\/strong> string prefixed with a <strong>dollar <em>($)<\/em> sign symbol<\/strong> can includes <strong>interpolation expression<\/strong>.<\/p>\n<h1>Syntax<\/h1>\n<pre style=\"white-space: pre;\">$\"&lt;STRING&gt;\"<\/pre>\n<p>The STRING token can have interpolation expression and has the following syntax:<\/p>\n<pre style=\"white-space: pre;\">{&lt;INTERPOLATION_EXPRESSION&gt;[,&lt;ALIGNMENT&gt;][:&lt;FORMAT_STRING&gt;]}<\/pre>\n<table>\n<tbody>\n<tr>\n<td><strong>Token<\/strong><\/td>\n<td><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td>INTERPOLATION_EXPRESSION<\/td>\n<td>The part that will produce a formatted output.<\/td>\n<\/tr>\n<tr>\n<td>ALIGNMENT<\/td>\n<td>Imposed a minimum number of character. If positive it is right-aligned and if negative it is left-aligned.<\/td>\n<\/tr>\n<tr>\n<td>FORMAT_STRING<\/td>\n<td>A format that is supported by the expression. Find more on <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/standard\/base-types\/composite-formatting#format-string-component\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote><p>If you needed to include <strong>{<\/strong> or <strong>}<\/strong> in your string output, escape it as <strong>{{<\/strong> or <strong>}}<\/strong> respectively on which ever you need.<\/p><\/blockquote>\n<h1>Example<\/h1>\n<pre style=\"white-space: pre;\">var name = \"World\"\r\nvar greeting = $\"Hello {name}\"\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A double quoted string prefixed with a dollar ($) sign symbol can includes interpolation expression. Syntax $&#8221;&lt;STRING&gt;&#8221; The STRING token can have interpolation expression and has the following syntax: {&lt;INTERPOLATION_EXPRESSION&gt;[,&lt;ALIGNMENT&gt;][:&lt;FORMAT_STRING&gt;]} Token Description INTERPOLATION_EXPRESSION The part that will produce a formatted output. ALIGNMENT Imposed a minimum number of character. If positive it is right-aligned and if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[53],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1161"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1161"}],"version-history":[{"count":3,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1161\/revisions"}],"predecessor-version":[{"id":1164,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1161\/revisions\/1164"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}