pathWithoutTail method
Remove tail
then tail
presents.
See also pathTail, pathBeforeTail.
Implementation
String pathWithoutTail(String tail) {
final sp = pathToList;
final tp = tail.pathToList;
if (sp.isEmpty || tp.isEmpty || sp.length < tp.length) {
return npath;
}
var delta = 1;
for (; delta <= tp.length; ++delta) {
if (tp[tp.length - delta] != sp[sp.length - delta]) {
return npath;
}
}
return delta - 1 == tp.length
? sp.sublist(0, sp.length - delta + 1).listToNPath
: npath;
}