Documentation ¶
Overview ¶
A package of simple functions to manipulate strings.
Index ¶
- func Count(s, sep string) int
- func Fields(s string) []string
- func HasPrefix(s, prefix string) bool
- func HasSuffix(s, suffix string) bool
- func Index(s, sep string) int
- func Join(a []string, sep string) string
- func LastIndex(s, sep string) int
- func Map(mapping func(rune int) int, s string) string
- func Repeat(s string, count int) string
- func Split(s, sep string, n int) []string
- func SplitAfter(s, sep string, n int) []string
- func ToLower(s string) string
- func ToTitle(s string) string
- func ToUpper(s string) string
- func TrimSpace(s string) string
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fields ¶
Fields splits the string s around each instance of one or more consecutive white space characters, returning an array of substrings of s or an empty list if s contains only white space.
func Index ¶
Index returns the index of the first instance of sep in s, or -1 if sep is not present in s.
func Join ¶
Join concatenates the elements of a to create a single string. The separator string sep is placed between elements in the resulting string.
func LastIndex ¶
LastIndex returns the index of the last instance of sep in s, or -1 if sep is not present in s.
func Map ¶
Map returns a copy of the string s with all its characters modified according to the mapping function. If mapping returns a negative value, the character is dropped from the string with no replacement.
func Split ¶
Split splits the string s around each instance of sep, returning an array of substrings of s. If sep is empty, Split splits s after each UTF-8 sequence. If n > 0, Split splits s into at most n substrings; the last substring will be the unsplit remainder.
func SplitAfter ¶
SplitAfter splits the string s after each instance of sep, returning an array of substrings of s. If sep is empty, SplitAfter splits s after each UTF-8 sequence. If n > 0, SplitAfter splits s into at most n substrings; the last substring will be the unsplit remainder.
func ToLower ¶
ToLower returns a copy of the string s with all Unicode letters mapped to their lower case.
func ToTitle ¶
ToTitle returns a copy of the string s with all Unicode letters mapped to their title case.