removeSurrounding method

String removeSurrounding(
  1. String prefix,
  2. String suffix
)

Implementation

String removeSurrounding(String prefix, String suffix) {
  if (length >= prefix.length + suffix.length &&
      startsWith(prefix) &&
      endsWith(suffix)) {
    return substring(prefix.length, length - suffix.length);
  }
  return this;
}