csstring

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interpolate

func Interpolate(s string, data interface{}) (string, error)

Interpolate fills a string template with the given values, can be map or struct. example: Interpolate("{{.Name}}", map[string]string{"Name": "JohnDoe"})

func StrictExpand

func StrictExpand(s string, mapping func(string) (string, bool)) string

StrictExpand replaces ${var} or $var in the string according to the mapping function, like os.Expand. The difference is that the mapping function returns a boolean indicating whether the variable was found. If the variable was not found, the string is not modified.

Whereas os.ExpandEnv uses os.Getenv, here we can use os.LookupEnv to distinguish between an empty variable and an undefined one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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