apartBy method
通过gap字符串分割字符串, 从前到后分析
返回一个元组,包含分割后的第一个部分和剩余部分。 如果gap不存在,则返回(null, 原字符串)
Implementation
(String?, String?) apartBy(String gap) {
final int pos = this.indexOf(gap);
if (pos == -1) {
return (null, this);
}
final String first = this.substring(0, pos);
final String last = this.substring(pos + gap.length);
return (first, last);
}