String interpolation

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 10 03:59:54 PST 2015


On Tuesday, 10 November 2015 at 11:22:56 UTC, wobbles wrote:
> On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote:
>> On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath 
>> wrote:
>>> On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes 
>>> wrote:
>>>> [...]
>>>
>>> std.string.format and std.format are the standard options. 
>>> What are you missing?
>>
>> Ruby:
>> a = 1
>> b = 4
>> puts "The number #{a} is less than #{b}"
>>
>> PHP:
>> $a = 1;
>> $b = 4;
>> echo "The number $a is less than $b";
>>
>> D:
>> ???
>
> int a = 1;
> int b = 4;
> writefln("The number %s is less than %s", a, b);

D:
int a = 1;
int b = 4;
writeln("The number ", a, " is less than ", b);


More information about the Digitalmars-d-learn mailing list