예제 #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,
}
예제 #2
0
func ExampleTestStringSplit0() {
	fmt.Print(easygenapi.Generate0(false, `{{split .Colorlist}}`, "test/list0"))
	// Output:
	// [red blue white]
}
예제 #3
0
func ExampleTestStringSplit1() {
	fmt.Print(easygenapi.Generate0(false, `{{range (split .Colorlist)}}{{.}} {{end}}`, "test/list0"))
	// Output:
	// red blue white
}
예제 #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.
}