http://d.puremagic.com/issues/show_bug.cgi?id=3218
Andrei Alexandrescu <and...@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #1 from Andrei Alexandrescu <and...@metalanguage.com> 2009-08-28 09:54:16 PDT --- I changed encode (which was indeed horrendous) to this: S encode(S)(S s, S buffer = null) { string r; size_t lastI; if (buffer) buffer.length = 0; auto result = Appender!(string)(&buffer); foreach (i, c; s) { switch (c) { case '&': r = "&"; break; case '"': r = """; break; case '\'': r = "'"; break; case '<': r = "<"; break; case '>': r = ">"; break; default: continue; } // Replace with r result.put(s[lastI .. i]); result.put(r); lastI = i + 1; } if (!result.data) return s; result.put(s[lastI .. $]); return result.data; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------