Skip to main content Module strings Copy item path Source Builder Reader Replacer Clone strings.Clone(s) — returns a fresh copy of s. In Go this disentangles
a string’s underlying storage; in goish String is owned so it’s a
plain clone. Compare strings.Compare(a, b) — returns -1 / 0 / 1 per lexicographic order. Contains ContainsAny ContainsRune Count Cut strings.Cut(s, sep) — slices s around the first instance of sep.
Returns (before, after, found). If sep not in s, returns (s, “”, false).CutPrefix strings.CutPrefix(s, prefix) — if prefix matches, returns (after, true); else (s, false).CutSuffix strings.CutSuffix(s, suffix) — if suffix matches, returns (before, true); else (s, false).EqualFold ASCII-only fold (Go does full Unicode; close enough for now).
strings.EqualFold(s, t) — Unicode case-insensitive equality. Uses
Rust’s char::to_lowercase for folding so Greek/Latin/Cyrillic etc
compare correctly (not just ASCII). Fields FieldsFunc strings.FieldsFunc(s, f) — split s around runs of runes where f is true.HasPrefix HasSuffix Index strings.Index — byte index of first occurrence, or -1. IndexAny IndexByte IndexFunc strings.IndexFunc(s, f) — first index where f(rune) is true, or -1.IndexRune Join LastIndex LastIndexAny strings.LastIndexAny(s, chars) — greatest index of a rune in chars
appearing in s, or -1.LastIndexByte strings.LastIndexByte(s, c) — last index of the byte c in s, or -1.LastIndexFunc strings.LastIndexFunc(s, f) — last index where f(rune) is true, or -1.Map NewReader strings.NewReader(s) — construct a Reader over the string. NewReplacer strings.NewReplacer(“old1”,“new1”,“old2”,“new2”,…) Repeat Replace strings.Replace — replace first n occurrences (n<0 = all). ReplaceAll Split SplitAfter strings.SplitAfter(s, sep) — like Split but keeps sep at the end of
each chunk.SplitN strings.SplitN — like Split but stops after n substrings (n<0 = all, n==0 = empty). Title ToLower ToUpper Trim TrimFunc strings.TrimFunc(s, f) — trim runes satisfying f from both ends.TrimLeft strings.TrimLeft(s, cutset) — drop leading runes in cutset.TrimLeftFunc strings.TrimLeftFunc(s, f) — trim runes satisfying f from the start.TrimPrefix TrimRight strings.TrimRight(s, cutset) — drop trailing runes in cutset.TrimRightFunc strings.TrimRightFunc(s, f) — trim runes satisfying f from the end.TrimSpace TrimSuffix