Custom string delimiters in Swift 5
Perl 6 (Raku) takes it a little further with what&#x27;s known as the Q lang[1].
In their most literal form possible, strings are created by using a Q followed
by any pair delimiting surrounding the text.<p><pre><code>    Q[This is a literal string.]        #=&gt; This is a literal string.
    Q!The most literal-est of all.!     #=&gt; The most literal-est of all.
    Q&lt;So I say &#x27;Hello&#x27;&gt;                 #=&gt; So I say &#x27;Hello&#x27;
</code></pre>
From there, adverbs are used to sort of expand a literal string&#x27;s behavior. 
For example, `Q:q` (or its more verbose form, `Q:single`) means the string can
interpolate \\, \qq[...] and escaping the delimiter with \.<p><pre><code>    Q:q[A simple string]                #=&gt; A simple string
    Q:q{Backslash: \}                   #=&gt; Backslash: \
    Q:q!Backslash: \\!                  #=&gt; Backslash: \
    Q:q{This is a \} so not too early.} #=&gt; This is a } so not too early.
 
 </code></pre>
In the other hand, `Q:qq` (or `Q:double`) means the string can 
interpolate scalars (`$`), arrays (`@`), hashes (`%`), function calls (`&amp;`),
closure (`{...}`) and backslashes.<p><pre><code>    my $bool = True;
    my @bools = True, False;
    my %bools = False =&gt; 0, True =&gt; 1;

    Q:qq[Scalar: $bool]                        #=&gt; «Scalar: True»
    Q:qq{Array: @bools[]}                      #=&gt; «Array: True False»
    Q:qq (Hash: %bools{})                      #=&gt; «Hash: False	0␤True  1»
    Q:qq!Function: %bools.keys.join(&#x27; and &#x27;)!  #=&gt; «Function: False and True»
    Q:qq&lt;Expression: { 1.0 + 2.0 == 3.0 }&gt;     #=&gt; «Expression: True»
</code></pre>
In order to prevent unwanted interpolation such as in &quot;username@email.xyz&quot; or
&quot;<a href="https:&#x2F;&#x2F;es.wikipedia.org&#x2F;wiki&#x2F;Ç&quot;" rel="nofollow">https:&#x2F;&#x2F;es.wikipedia.org&#x2F;wiki&#x2F;Ç&quot;</a>, only scalar variables are interpolated
normally. As demonstrated, the array constructor `[]` is used to interpolate
a whole array , the hash constructor `{}` for a hash, etc.<p>Since both `Q:q` and `Q:qq` are so common in the language, they have more
usual and succinct forms: single quotes (`&#x27;&#x27;`) for `Q:q` and double quotes(`&quot;&quot;`)
for `Q:qq`. Furthermore the Q can be dropped so `q` or `qq` (followed by
a delimiter) can be used as well.<p>From here onwards, a small number of adverbs can be used on the quoting
constructs `q` or `qq` to further restrict&#x2F;expand a string&#x27;s behavior. 
For example, for a string that only interpolates scalar ($) and closure ({...})
variables, the adverbs `:s` (or `:scalar`) and `:c` (or `:closure`) can be used.
This results in `qq:s:c` (or `qq:sc`, `qq:scalar:closure`). For example:<p><pre><code>    my $var = 25;
    qq:s:c&lt;$var: { 3**2 + 4**2 }&gt; #=&gt; «25: 25»
</code></pre>
Another example is the use of `q` with the `:to` (or `:heredoc`) adverb 
which seems to be the closest construct to Swift 5&#x27;s custom string delimiters:<p><pre><code>    my $billTheCat = q:to&#x2F;BILL&#x2F;;
    &lt;------- ____
      &amp;&amp;&amp;    &#x2F;    \  __ _____,
        `-- |  o   \&#x27;  `  &amp;&amp;&#x2F;
           `|      | o  },-&#x27;
             \____( )__&#x2F;
             ,&#x27;    \&#x27;   \
     &#x2F;~~~~~~|.      |   .}~~~\
      ,-----( .     |   .}--.
            | .    &#x2F;\___&#x2F;
             `----^,\ \
                    \_&#x2F;
    BILL
    
</code></pre>
[1] <a href="https:&#x2F;&#x2F;docs.perl6.org&#x2F;language&#x2F;quoting" rel="nofollow">https:&#x2F;&#x2F;docs.perl6.org&#x2F;language&#x2F;quoting</a>