How to use sprintf

Benjamin Thaut code at benjamin-thaut.de
Sun Apr 24 14:53:41 PDT 2011


If you just want to format a string use std.string.format.

import std.string;

int i=1;
float f=2.5f;
string s = "test";
string output = format("%s %s %s",i,f,s);

If you use the %s placeholder the type will automatically be determined 
and printed out correctly.
-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list