Interpolation Expression Sequence (IES): Will Delimited Strings Ever Be Supported?
kdevel
kdevel at vogtner.de
Fri Aug 16 13:18:40 UTC 2024
On Friday, 16 August 2024 at 12:55:42 UTC, Dejan Lekic wrote:
> After talking to Adam on IRC, he pointed out that i`` works, so
> I was wrong apparently. The following works:
>
> ```
> string title = "D roX";
> auto html = i`
> <!DOCTYPE html>
> <html>
> <head>
> <title>$(title)</title>
> <link rel = "stylesheet" href = "style.css">
> </head>
> <body>
> `;
> ```
There is a \n at the beginning of the string. That is the reason
for
using a delimited string [1]
```
auto html = q"DELIMTER
<!DOCTYPE html>
...
DELIMITER";
````
[1] https://dlang.org/spec/lex.html#delimited_strings "The
newline following the opening identifier is not part of the
string [...]"
More information about the Digitalmars-d
mailing list