September 19, 2003 String formatting revisited (yet again) | ||||
---|---|---|---|---|
| ||||
D's shiny new opCall overload gave me a chance to improve the interface of my printf-workalike. import formatter; /* * the trailing () is needed to convert the formatter object to a * string, since implicit conversions are not possible */ char[] result = format("{0} + {1} = {2}") (5) (2) ("Spam") (); You can grab it at http://ikagames.com/andy/d/console-19-sep-2003.zip |
Copyright © 1999-2021 by the D Language Foundation