Exemple #1
0
//==========================================================================
// list0 data + string template
// I.e.: EasyGen -ts "{{range .Colors}}{{.}}, {{end}}" test/list0
func ExampleList0StrTemplate() {
	fmt.Print(easygenapi.Generate0(false, "{{range .Colors}}{{.}}, {{end}}", "test/list0"))
	// Output:
	// red, blue, white,
}
Exemple #2
0
func ExampleTestStringSplit0() {
	fmt.Print(easygenapi.Generate0(false, `{{split .Colorlist}}`, "test/list0"))
	// Output:
	// [red blue white]
}
Exemple #3
0
func ExampleTestStringSplit1() {
	fmt.Print(easygenapi.Generate0(false, `{{range (split .Colorlist)}}{{.}} {{end}}`, "test/list0"))
	// Output:
	// red blue white
}
Exemple #4
0
func ExampleTestStringsCmp() {
	fmt.Print(easygenapi.Generate0(false, `The {{if eq .StrTest "-AB-axxb- HTML Html html"}}eq says Yea{{else}}eq says Nay{{end}} but {{if eqf .StrTest "-AB-axxb- HTML Html html"}}eqf says Yea{{else}}eqf says Nay{{end}}.`, "test/strings0"))
	// Output:
	// The eq says Nay but eqf says Yea.
}