splitRight method

(String?, String?) splitRight(
  1. String gap
)

通过gap字符串分割字符串, 从后到前分析

返回一个元组,包含分割后的第一个部分和剩余部分。 如果gap不存在,则返回(null, 原字符串)

Implementation

(String?, String?) splitRight(String gap) {
  final int pos = lastIndexOf(gap);
  if (pos == -1) {
    return (null, this);
  }
  final String first = substring(0, pos);
  final String last = substring(pos + gap.length);
  return (first, last);
}