How about appender.put() with var args?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 15 12:16:55 PDT 2015


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


More information about the Digitalmars-d mailing list