How about appender.put() with var args?
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 15 13:34:28 PDT 2015
On Wednesday, 15 April 2015 at 19:16:55 UTC, Steven Schveighoffer
wrote:
> On 4/15/15 3:09 PM, "=?UTF-8?B?Ik3DoXJjaW8=?= Martins\"
> <marcioapm at gmail.com>\"" wrote:
>> Hi!
>>
>> I use Appender a lot, and find it ugly to write this all the
>> time to
>> efficiently construct strings:
>>
>> app.put("foo");
>> app.put(var);
>> app.put("bar");
>>
>> How about this instead?
>>
>> app.put("foo", var, "bar");
>>
>> This would be consistent with the writeln interface, and it
>> could also
>> reduce the syntax overhead of using appenders vs string
>> concats.
>>
>> Was this overlooked or is there some issue I am not seeing? :)
>>
>> Cheers,
>> -M
>
> What about:
>
> import std.format;
> app.formattedWrite("foo%sbar", var);
>
> -Steve
Well, but wouldn't that incur the cost of parsing the format
string, for no benefit?
More information about the Digitalmars-d
mailing list