String Interpolation

kdevel kdevel at vogtner.de
Wed Nov 1 21:24:44 UTC 2023


On Saturday, 21 October 2023 at 18:14:55 UTC, Patrick Schluter 
wrote:
> [...]
> By the very nature of what interpolated strings are it is not 
> possible to treat them as strings.

True. BTW: How can interpolations be wrapped? Consider the 
follwing code fragment

```d
     auto query = i"select a from b where c = ${d}";
```

occurring in the same code unit as

```d
     auto path = i"${basepath}/${configdir1}/${filename}";
```

How can one selectively wrap only those interpolations which 
concatenate path components but leave the sql queries untouched? 
If one used buildPath [1] from the very start this would be a 
non-problem.


[1] 
https://forum.dlang.org/post/jctprfyaolylrxwoymjm@forum.dlang.org


More information about the Digitalmars-d mailing list