removeSuffix method

String removeSuffix(
  1. String suffix
)

移出尾部指定 suffix 不包含不移出

Implementation

String removeSuffix(String suffix) {
  if (!endsWith(suffix)) return this;
  return substring(0, length - suffix.length);
}