Strings In Depth11 / 17
Up next

Slice by byte range

package main

import "fmt"

func main() {
	s := "hello world"
	// half-open range: start included, end excluded
	fmt.Println(s[0:5])
	fmt.Println(s[6:])
}
What you're solving

s[a:b] uses byte offsets