replaceChar method

String replaceChar(
  1. String s,
  2. int offset,
  3. String c
)

Implementation

String replaceChar(String s, int offset, String c) {
  if (offset == 0) {
    return '$c${s.substring(1)}';
  } else {
    return '${s.substring(0, offset)}$c${s.substring(offset + 1)}';
  }
}