string replaceWhole(string a) { switch (x) { case "a": return "1"; case "b": return "2"; default: return x; } }
? Desired interface y = x.replaceWhole!("a","x", "b","y", "c","z") or perhaps y = x.replaceWhole!(tuple("a","x"), tuple("b","y"), tuple("c","z")) kind of like "a".among!("a", "b", "c") but for replacements.