Esempio n. 1
0
func ExampleParseString() {
	var r interface{}
	var ok bool
	prt := func() {
		if ok {
			fmt.Printf("Result: %c\n", r)
		} else {
			fmt.Printf("Error: %v\n", r)
		}
	}

	p := kern.Symbol(utf88.Codepoint('a'))

	t := "abc"
	r, ok = kern.ParseString(p, t)
	prt()

	u := "defg"
	r, ok = kern.ParseString(p, u)
	prt()

	// Output:
	// Result: a
	// Error: Unexpected d input.
}
Esempio n. 2
0
func ExampleSymbol() {
	p := kern.Symbol(utf88.Codepoint('a'))

	t := utf88.Text("abc")
	r, ok := kern.ParseText(p, t)
	if ok {
		fmt.Printf("Result: %c\n", r)
	} else {
		fmt.Printf("Error: %v\n", r)
	}

	// Output:
	// Result: a
}