Documentation ¶
Overview ¶
kvstring package contains functions for representing string key:value pairs as one string and converting such strings to maps etc.
Index ¶
- Constants
- func MapSubset(m1, m2 map[string]string) bool
- func MapsEquals(m1, m2 map[string]string) bool
- func RemoveCurlyBraces(str string) (string, error)
- func SplitString(str string, kvSep, fldSep byte, buf []string) ([]string, error)
- func ToMap(kvs string) (map[string]string, error)
- func TrimSpaces(str string) string
Constants ¶
const ( KeyValueSeparator = "=" FieldsSeparator = "," )
Variables ¶
This section is empty.
Functions ¶
func MapSubset ¶
MapSubset returns whether m1 is subset of m2 (all m1's key-values are in m2 as well)
func MapsEquals ¶
MapsEquals returns whether m1 equals to m2
func RemoveCurlyBraces ¶
RemoveCurlyBraces trims leading and trailing spaces and curly braces. For example input strings like ` { abc } ` will get as a result `abc` string
func SplitString ¶
SplitString receves key-value string where the key-value separator is kvSep, and the pairs are separated by fldSep. For example in the string `name=app1,ip=1234` the kvSep is '=' and fldSep is ','. The SplitString expects the result buf which will be used for preparing result. key or value could contain fldSep or kvSep chars, if the value is put into quotes.
Types ¶
This section is empty.