https://github.com/Knetic/govaluate#what-operators-and-types-does-this-support https://github.com/Knetic/govaluate/blob/master/MANUAL.md
- parses string as integer
- signature: func(string)int64
- example:
atoi(x) == 42
- parses string as float
- signature: func(string)float64
- example:
atof(x) == 42.13
- formats number as string
- signature: func(number)string; number may be int, int16, int32, int64, float32, float64
- example:
ntoa(x) == "42"
- returns length of string
- signature: func(string)int
- example:
strlen("42") == 2
- returns the index of the first instance of substr in s, or -1 if substr is not present in s
- signature: func(s string, substr string)int
- example:
strIndex("4.2", ".") == 1
- returns a slice of the string s, from 'from' up to excluding 'to'
- signature: func(s string, from int, to int)string
- example:
substr("0123456789", 2, 4) == "23"
- returns s without the provided leading prefix string. if s doesn't start with prefix, s is returned unchanged.
- signature: func(s string, prefix string)string
- example:
trimPrefix("foo:4.2", "foo:") == "4.2"
- returns s without the provided trailing suffix string. if s doesn't end with suffix, s is returned unchanged.
- signature: func(s string, suffix string)string
- example:
trimSuffix("foo:4.2", ":4.2") == "foo"
- returns a copy of the string s with all non-overlapping instances of old replaced by new. if old is empty, it matches at the beginning of the string
- signature: func(s string, old string, new string)string
- example:
replace("foo:4.2", ":", "/") == "foo/4.2"
- returns s with all Unicode letters mapped to their upper case.
- signature: func(s string)string
- example:
toUpperCase("fooBAR") == "FOOBAR"
- returns s with all Unicode letters mapped to their lower case.
- signature: func(s string)string
- example:
toLowerCase("fooBAR") == "foobar"
- returns element of a map
- signature: func(m map[string]interface{}, key string)map[string]interface
- example:
mapGet(x, "foo")
- sets element of a map and returns the new map
- signature: func(m map[string]interface{}, key string, value interface{})map[string]interface
- example:
mapSet(x, "bar", 42)
- removes element of a map
- signature: func(m map[string]interface{}, key string)map[string]interface
- example:
mapDelete(x, "bar")
to get a graph of possible conversions, call
go generate ./...
which prints a dot graph. you can use https://dreampuf.github.io/GraphvizOnline to generate images from the output.