let s = "hello world" // prefix returns a Substring sharing s's storage let head: Substring = s.prefix(5) print(head) // build an independent String when you need to store it let owned = String(head) print(owned)
prefix/suffix give a Substring