type RuneRole … const RNone … const RSep … const RTail … const RUCTail … const RHead … // RuneRoles detects the roles of each byte rune in an input string and stores it in the output // slice. The rune role depends on the input type. Stops when it parsed all the runes in the string // or when it filled the output. If output is nil, then it gets created. func RuneRoles(candidate []byte, reuse []RuneRole) []RuneRole { … } type runeType … const rtNone … const rtPunct … const rtLower … const rtUpper … const rt … // LastSegment returns the substring representing the last segment from the input, where each // byte has an associated RuneRole in the roles slice. This makes sense only for inputs of Symbol // or Filename type. func LastSegment(input string, roles []RuneRole) string { … } // fromChunks copies string chunks into the given buffer. func fromChunks(chunks []string, buffer []byte) []byte { … } // toLower transforms the input string to lower case, which is stored in the output byte slice. // The lower casing considers only ASCII values - non ASCII values are left unmodified. // Stops when parsed all input or when it filled the output slice. If output is nil, then it gets // created. func toLower(input []byte, reuse []byte) []byte { … } type WordConsumer … // Words find word delimiters in an input based on its bytes' mappings to rune roles. The offset // delimiters for each word are fed to the provided consumer function. func Words(roles []RuneRole, consume WordConsumer) { … }