removePrefix method

String removePrefix(
  1. String prefix
)

If this String starts with the given prefix, returns a copy of this string with the prefix removed. Otherwise, returns this String.

Implementation

String removePrefix(String prefix) {
  if (startsWith(prefix)) {
    return substring(prefix.length, length);
  } else {
    return this;
  }
}