Just another example of missing string interpolation

Andrea Fontana nospam at example.org
Sun Oct 15 08:18:04 UTC 2023


On Sunday, 15 October 2023 at 07:10:39 UTC, Imperatorn wrote:
> On Sunday, 15 October 2023 at 07:10:06 UTC, Imperatorn wrote:
>> On Saturday, 14 October 2023 at 20:05:42 UTC, Andrea Fontana 
>> wrote:
>>> On Saturday, 14 October 2023 at 14:47:26 UTC, Andrey Zherikov 
>>> wrote:
>>>>
>>>> Why does not this work for you?
>>>> ```d
>>>> string s = text("Hello ",name,", you are ",age," years old 
>>>> and have ",money - 42," dollars in the bank");
>>>> ```
>>>
>>> Check the first post.
>>
>> I would actually be fine with smith like
>>
>> interp!"Hello {name}, your name is {name} and you have {money 
>> -42} dollars in the bank" until he have a character to use for 
>> it
>
> Typo but you get the point 😅

Yes these versions are fine too

i"hello ${world+1} $another_var"

or:

"""hello ${word+1} $another_var"""

or:

$"hello ${world+1} $another_var"

or:

"hello %{world+1} %another_var"!

or whatever enables string interpolation :)



More information about the Digitalmars-d mailing list