Substring

struct Substring

A borrowed contiguous byte range of an existing UTF-8 string.

start..<start + byte_count must lie within storage and align with the operation that created it. Unlike String, a substring does not own or resize storage; to_string copies the range into a new owner.

Properties

let start: Int

The inclusive starting byte offset in the source.

let byte_count: Int

The number of bytes in the encoded representation.