stringutil

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CutPrefix

func CutPrefix(s, prefix string) (after string, found bool)

CutPrefix behaves like strings.Cut, but only cuts a prefix, not anywhere in the string.

func CutTwice

func CutTwice(s, sep1, sep2 string) (before, between, after string, found bool)

CutTwice calls strings.Cut twice to split s into three strings. If either separator isn't found in s, returns s, "", "", false.

func ReadJSONFile

func ReadJSONFile(path string, i interface{}) (err error)

ReadJSONFile reads one JSON value from the specified file.

func WriteJSONFile

func WriteJSONFile(path string, i interface{}) (err error)

WriteJSONFile writes one specified value to a file as indented JSON with a trailing newline.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL