Just another example of missing string interpolation
bachmeier
no at spam.net
Fri Oct 13 14:25:34 UTC 2023
On Friday, 13 October 2023 at 12:04:18 UTC, kdevel wrote:
> On Thursday, 12 October 2023 at 21:45:55 UTC, bachmeier wrote:
>>> [...]
>>> What if `s` is `"${a}"` and `subs` is `["a": "${b}", "b":
>>> "x"]`?
>>
>> That's the reason it needs to be supported by the language.
>
> The problem with your code is that it loops over the wrong list.
> It should iterate over the variable occurrences in the string
> `s`.
That depends. If you don't want to do all of the substitutions,
either because you potentially have `${something}` as part of the
final string, or because you don't want to do all substitutions
at once, those cases are trivially handled by my function. It
works for what I do.
More information about the Digitalmars-d
mailing list