Documentation
¶
Index ¶
- func CutLast(s, sep string) (before, after string, found bool)
- func CutPrefix(s, prefix string) (after string, found bool)
- func CutSuffix(s, suffix string) (before string, found bool)
- func CutTwice(s, sep1, sep2 string) (before, between, after string, found bool)
- func ReadJSONFile(path string, i any) (err error)
- func WriteJSONFile(path string, i any) (err error)
- type CRLFToLF
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CutLast ¶ added in v0.0.3
CutLast is strings.Cut, but cutting at the last occurrence of sep rather than the first.
func CutPrefix ¶
CutPrefix behaves like strings.Cut, but only cuts a prefix, not anywhere in the string.
func CutSuffix ¶ added in v0.0.3
CutSuffix behaves like strings.Cut, but only cuts a suffix, not anywhere in the string.
func CutTwice ¶
CutTwice calls strings.Cut twice to split s into three strings. If either separator isn't found in s, returns s, "", "", false.
func ReadJSONFile ¶
ReadJSONFile reads one JSON value from the specified file. Supports BOM.
func WriteJSONFile ¶
WriteJSONFile writes one specified value to a file as indented JSON with a trailing newline.
Types ¶
type CRLFToLF ¶ added in v0.0.8
type CRLFToLF struct{}
CRLFToLF is a transform.Transformer that converts all occurrences of "\r\n" to "\n", leaving lone '\r' (not followed by '\n') untouched.
func (CRLFToLF) Reset ¶ added in v0.0.8
func (CRLFToLF) Reset()
Reset implements transform.Transformer. No state to clear.