+| `offset` | Offset corresponds to the index of the start segment, and length refers to how many segments to capture (including the one at index = offset). <br> Assuming offset and length are positive, the following logic applies: <br> <ul><li>If length isn't included, capture the segment at index = offset.</li><li> When length is included, capture segments from index = offset up until index = offset + length</li></ul><br>The following special cases are also handled:<br><ul><li>If offset is negative, count backwards from end of the path to get the starting segment.</li><li>If offset is a negative value greater than or equal to the number of segments, set to 0.</li><li>If offset is greater than the number of segments, the result is empty.</li><li>If length is 0, then return the single segment specified by offset.</li><li>If length is negative, treat it as a second offset and calculate backwards from the end of the path. If the value is less than offset, it results in an empty string.</li><li>If length is greater than the number of segments, return what remains in the path.</li> |
0 commit comments