a function like writeln that returns a string rather than writes to a file
dan
dan.hitt at gmail.com
Sat May 2 03:09:42 UTC 2020
On Saturday, 2 May 2020 at 02:49:04 UTC, Steven Schveighoffer
wrote:
> On 5/1/20 10:40 PM, dan wrote:
>> On Saturday, 2 May 2020 at 02:29:43 UTC, H. S. Teoh wrote:
>>> On Sat, May 02, 2020 at 02:22:42AM +0000, dan via
>>> Digitalmars-d-learn wrote:
>>>> [...]
>>> [...]
>>>
>>> import std.format : format;
>>> string str = format("%s %s %s", obj1, obj2, obj3);
>>>
>>>
>>> T
>>
>> Thanks HS!
>>
>> That looks like a good move, if format will do the string
>> conversion for me.
>>
>> But one thing that would be troublesome is that i would have
>> to make sure to count up the %s so that they match the number
>> of arguments. I would like to do without that, just like
>> writeln does.
>
> import std.conv: text;
>
> string str = text(obj1, " ", obj2, " ", obj3);
>
> -Steve
Awesome, thanks Steve. That's perfect. So the function i was
looking for was text (or, i guess, std.conv.text).
dan
More information about the Digitalmars-d-learn
mailing list