| 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 |
|
| 5 |
package norm_test |
| 6 |
|
| 7 |
import ( |
| 8 |
"fmt" |
| 9 |
|
| 10 |
"golang.org/x/text/unicode/norm" |
| 11 |
) |
| 12 |
|
| 13 |
func ExampleForm_NextBoundary() { |
| 14 |
s := norm.NFD.String("Mêlée") |
| 15 |
|
| 16 |
for i := 0; i < len(s); { |
| 17 |
d := norm.NFC.NextBoundaryInString(s[i:], true) |
| 18 |
fmt.Printf("%[1]s: %+[1]q\n", s[i:i+d]) |
| 19 |
i += d |
| 20 |
} |
| 21 |
// Output: |
| 22 |
// M: "M" |
| 23 |
// ê: "e\u0302" |
| 24 |
// l: "l" |
| 25 |
// é: "e\u0301" |
| 26 |
// e: "e" |
| 27 |
} |