The original string.
The string indicating which characters to replace and what to replace them with. It is generated by makeTransTable.
The characters to remove from the string.
An output range to write the contents to.
import std.array : appender; auto buffer = appender!(char[])(); auto transTable1 = makeTransTable("eo5", "57q"); translate("hello world", transTable1, null, buffer); assert(buffer.data == "h5ll7 w7rld"); buffer.clear(); translate("hello world", transTable1, "low", buffer); assert(buffer.data == "h5 rd");
This is an ASCII-only overload of translate which takes an existing buffer to write the contents to.