Just another example of missing string interpolation

kdevel kdevel at vogtner.de
Thu Oct 12 19:42:41 UTC 2023


On Thursday, 12 October 2023 at 16:31:39 UTC, bachmeier wrote:
> [...] I use a generalization of this:
>
> ```
> string interp(string s, string[string] subs) {
>   foreach(k; subs.keys) {
>     s = s.replace("${" ~ k ~ "}", subs[k]);
>   }
>   return s;
> }
> ```

What if `s` is `"${a}"` and `subs` is `["a": "${b}", "b": "x"]`?



More information about the Digitalmars-d mailing list