Go String
16 functions
strings.Containsstrings.Contains(s, substr string) boolReports whether substr is within s.
strings.HasPrefixstrings.HasPrefix(s, prefix string) boolReports whether s begins with prefix.
strings.HasSuffixstrings.HasSuffix(s, suffix string) boolReports whether s ends with suffix.
strings.Indexstrings.Index(s, substr string) intReturns the index of the first instance of substr in s, or -1.
strings.Countstrings.Count(s, substr string) intCounts the number of non-overlapping instances of substr in s.
strings.Replacestrings.Replace(s, old, new string, n int) stringReturns a copy of s with the first n occurrences of old replaced by new.
strings.ReplaceAllstrings.ReplaceAll(s, old, new string) stringReturns a copy of s with all occurrences of old replaced by new.
strings.Splitstrings.Split(s, sep string) []stringSlices s into all substrings separated by sep.
strings.Joinstrings.Join(elems []string, sep string) stringConcatenates the elements of elems to create a single string separated by sep.
strings.ToLowerstrings.ToLower(s string) stringReturns s with all Unicode letters mapped to their lower case.
strings.ToUpperstrings.ToUpper(s string) stringReturns s with all Unicode letters mapped to their upper case.
strings.TrimSpacestrings.TrimSpace(s string) stringReturns a slice of s with all leading and trailing white space removed.
strings.Trimstrings.Trim(s, cutset string) stringReturns a slice of s with all leading and trailing cutset characters removed.
strings.Fieldsstrings.Fields(s string) []stringSplits s around each instance of whitespace and returns a slice of substrings.
strings.Repeatstrings.Repeat(s string, count int) stringReturns a new string consisting of count copies of s.
strings.ContainsAnystrings.ContainsAny(s, chars string) boolReports whether any Unicode code points in chars are within s.
