On Sun, Jul 11, 2010 at 18:58, Rory McGuire <rmcgu...@neonova.co.za> wrote:
> On Sun, 11 Jul 2010 15:29:36 +0200, Michel Fortin < > michel.for...@michelf.com> wrote: > >> >> int num = 1; >> string result = substitute!"Number: $num"; >> assert(result == "Number: 1"); >> >> > someone already made something like that, I forget where it was. Its old > now. > Doesn't Format (in std.metastrings) cover part of this? string result = Format!("Numbers: %s", to!string(num)); I remember finding it cumbersome to use. For one, it could easily take any type for argument, and call to!string on them internally. Why bothering me with this? But maybe I wasn't using it the right way. Hmm, I think what I'd like is some numbered substituting scheme: string result = Substitute!("static if (is (typeof(%1) t == %2!U, U)) { alias U Result; else alias typeof(%1) Result;", a,b); I agree with Rory than someone already did something similar. But I guess now it can be done with CTFE on strings. A CT replace. Philippe