package str
import "cmd/go/internal/str"
Package str provides string manipulation utilities.
Index ¶
- func Contains(x []string, s string) bool
- func FoldDup(list []string) (string, string)
- func GlobsMatchPath(globs, target string) bool
- func HasFilePathPrefix(s, prefix string) bool
- func HasPathPrefix(s, prefix string) bool
- func SplitQuotedFields(s string) ([]string, error)
- func StringList(args ...interface{}) []string
- func ToFold(s string) string
Functions ¶
func Contains ¶
Contains reports whether x contains s.
func FoldDup ¶
FoldDup reports a pair of strings from the list that are equal according to strings.EqualFold. It returns "", "" if there are no such strings.
func GlobsMatchPath ¶
GlobsMatchPath reports whether any path prefix of target matches one of the glob patterns (as defined by path.Match) in the comma-separated globs list. It ignores any empty or malformed patterns in the list.
func HasFilePathPrefix ¶
HasFilePathPrefix reports whether the filesystem path s begins with the elements in prefix.
func HasPathPrefix ¶
HasPathPrefix reports whether the slash-separated path s begins with the elements in prefix.
func SplitQuotedFields ¶
SplitQuotedFields splits s into a list of fields, allowing single or double quotes around elements. There is no unescaping or other processing within quoted fields.
func StringList ¶
func StringList(args ...interface{}) []string
StringList flattens its arguments into a single []string. Each argument in args must have type string or []string.
func ToFold ¶
ToFold returns a string with the property that
strings.EqualFold(s, t) iff ToFold(s) == ToFold(t)
This lets us test a large set of strings for fold-equivalent duplicates without making a quadratic number of calls to EqualFold. Note that strings.ToUpper and strings.ToLower do not have the desired property in some corner cases.
Source Files ¶
- Version
- v1.15.5
- Published
- Nov 12, 2020
- Platform
- darwin/amd64
- Imports
- 7 packages
- Last checked
- 1 minute ago –
Tools for package owners.