replaceSuffix method

String replaceSuffix(
  1. String from,
  2. String to
)

Implementation

String replaceSuffix(String from, String to) {
  if (endsWith(from)) {
    return replaceRange(length - from.length, null, to);
  } else {
    return this;
  }
}