splice function

String splice(
  1. String str,
  2. dynamic index,
  3. int count,
  4. dynamic add,
)

Implementation

String splice(String str, index, int count, add) {
  int i = index;
  if (i < 0) {
    i = str.length + i;
    if (i < 0) {
      i = 0;
    }
  }

  return str.substring(0, i) + (add | '') + str.substring(i + count);
}