util

package
v0.0.0-...-bb77216 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Comment = `#`
)

Functions

func CopyTo

func CopyTo(src *paths.Path, dst *paths.Path) error

CopyTo recursivelly copy all files from a source path to a destination path.

func DecodeHexInString

func DecodeHexInString(str string) string

DecodeHexInString decode and replace all hex value in a given string of "key=value" format.

func Filter

func Filter(src string) string

Filter out comments and empty line from a string

func MustReadFile

func MustReadFile(path *paths.Path) string

MustReadFile read a file and return its content as a string. Panic if an error occurs.

func MustReadFileAsLines

func MustReadFileAsLines(path *paths.Path) []string

MustReadFileAsLines read a file and return its content as a slice of string. It panics if an error occurs and filter out comments and empty lines.

func ReadFile

func ReadFile(path *paths.Path) (string, error)

ReadFile read a file and return its content as a string.

func RemoveDuplicate

func RemoveDuplicate[T comparable](inlist []T) []T

RemoveDuplicate filter out all duplicates from a slice. Also filter out empty element.

Types

type RegexRepl

type RegexRepl struct {
	Regex *regexp.Regexp
	Repl  string
}

type RegexReplList

type RegexReplList []RegexRepl

func ToRegexRepl

func ToRegexRepl(in []string) RegexReplList

ToRegexRepl convert slice of regex into a slice of RegexRepl

func (RegexReplList) Replace

func (rr RegexReplList) Replace(str string) string

Jump to

Keyboard shortcuts

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