Home | History | Annotate | Download | only in transform
      1 // Code generated by running "go run gen.go -core" in golang.org/x/text. DO NOT EDIT.
      2 
      3 // Copyright 2013 The Go Authors. All rights reserved.
      4 // Use of this source code is governed by a BSD-style
      5 // license that can be found in the LICENSE file.
      6 
      7 package transform_test
      8 
      9 import (
     10 	"fmt"
     11 	"unicode"
     12 
     13 	"golang_org/x/text/transform"
     14 	"golang_org/x/text/unicode/norm"
     15 )
     16 
     17 func ExampleRemoveFunc() {
     18 	input := []byte(`tsch;  `)
     19 
     20 	b := make([]byte, len(input))
     21 
     22 	t := transform.RemoveFunc(unicode.IsSpace)
     23 	n, _, _ := t.Transform(b, input, true)
     24 	fmt.Println(string(b[:n]))
     25 
     26 	t = transform.RemoveFunc(func(r rune) bool {
     27 		return !unicode.Is(unicode.Latin, r)
     28 	})
     29 	n, _, _ = t.Transform(b, input, true)
     30 	fmt.Println(string(b[:n]))
     31 
     32 	n, _, _ = t.Transform(b, norm.NFD.Bytes(input), true)
     33 	fmt.Println(string(b[:n]))
     34 
     35 	// Output:
     36 	// tsch;
     37 	// tsch
     38 	// tschu
     39 }
     40