You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

28 lines
517 B

  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package norm_test
  5. import (
  6. "fmt"
  7. "golang.org/x/text/unicode/norm"
  8. )
  9. func ExampleForm_NextBoundary() {
  10. s := norm.NFD.String("Mêlée")
  11. for i := 0; i < len(s); {
  12. d := norm.NFC.NextBoundaryInString(s[i:], true)
  13. fmt.Printf("%[1]s: %+[1]q\n", s[i:i+d])
  14. i += d
  15. }
  16. // Output:
  17. // M: "M"
  18. // ê: "e\u0302"
  19. // l: "l"
  20. // é: "e\u0301"
  21. // e: "e"
  22. }