Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseExpression ¶
ParseExpression parses a string template with variables in the format ${myVariable} and uses values from the context map to replace them. The resulting string is the template string with replaced values.
Example ¶
template := "{name} was born in {dob} in {location}. {name} hair is {hairColor}."
context := map[string]string{
"dob": "01/08/1956",
"hairColor": "black",
"location": "Japan",
"name": "John",
}
fmt.Println(ParseExpression(template, context))
Output: John was born in 01/08/1956 in Japan. John hair is black.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.