translate method

String translate(
  1. Map<int, int> table
)

Replace each character in the string using the given translation table.

Implementation

String translate(Map<int, int> table) {
  var buffer = StringBuffer();

  for (var rune in runes) {
    buffer.writeCharCode(table.containsKey(rune) ? table[rune]! : rune);
  }

  return buffer.toString();
}