Exemplo n.º 1
0
 public static StringSegment Subsegment(this string str, Range range)
 {
     var(offset, length) = range.GetOffsetAndLength(str.Length);
     return(new StringSegment(str, offset, length));
 }
Exemplo n.º 2
0
 public Memory <T> Slice(Range range)
 {
     (int start, int length) = range.GetOffsetAndLength(_length);
     // It is expected for _index + start to be negative if the memory is already pre-pinned.
     return(new Memory <T>(_object, _index + start, length));
 }
Exemplo n.º 3
0
 public Utf8String Substring(Range range)
 {
     (int start, int length) = range.GetOffsetAndLength(Length);
     return(Substring(start, length));
 }