stripPrefix method

Slice<T>? stripPrefix(
  1. Slice<T> prefix
)

Returns a subslice with the prefix removed. Returns null if the prefix is not present.

Implementation

Slice<T>? stripPrefix(Slice<T> prefix) {
  if (startsWith(prefix)) {
    return Slice(_list, _start + prefix._end - prefix._start, _end);
  }
  return null;
}