README.md
1Iterators which split strings on Grapheme Cluster or Word boundaries, according
2to the [Unicode Standard Annex #29](http://www.unicode.org/reports/tr29/) rules.
3
4[![Build Status](https://travis-ci.org/unicode-rs/unicode-segmentation.svg)](https://travis-ci.org/unicode-rs/unicode-segmentation)
5
6[Documentation](https://unicode-rs.github.io/unicode-segmentation/unicode_segmentation/index.html)
7
8```rust
9use unicode_segmentation::UnicodeSegmentation;
10
11fn main() {
12 let s = "a̐éö̲\r\n";
13 let g = UnicodeSegmentation::graphemes(s, true).collect::<Vec<&str>>();
14 let b: &[_] = &["a̐", "é", "ö̲", "\r\n"];
15 assert_eq!(g, b);
16
17 let s = "The quick (\"brown\") fox can't jump 32.3 feet, right?";
18 let w = s.unicode_words().collect::<Vec<&str>>();
19 let b: &[_] = &["The", "quick", "brown", "fox", "can't", "jump", "32.3", "feet", "right"];
20 assert_eq!(w, b);
21
22 let s = "The quick (\"brown\") fox";
23 let w = s.split_word_bounds().collect::<Vec<&str>>();
24 let b: &[_] = &["The", " ", "quick", " ", "(", "\"", "brown", "\"", ")", " ", " ", "fox"];
25 assert_eq!(w, b);
26}
27```
28
29# no_std
30
31unicode-segmentation does not depend on libstd, so it can be used in crates
32with the `#![no_std]` attribute.
33
34# crates.io
35
36You can use this package in your project by adding the following
37to your `Cargo.toml`:
38
39```toml
40[dependencies]
41unicode-segmentation = "1.3.0"
42```
43
44# Change Log
45
46## 1.6.0
47
48* [#72](https://github.com/unicode-rs/unicode-segmentation/pull/72) Upgrade to Unicode 12
49
50## 1.5.0
51
52* [#68](https://github.com/unicode-rs/unicode-segmentation/pull/68) Upgrade to Unicode 11
53
54## 1.4.0
55
56* [#56](https://github.com/unicode-rs/unicode-segmentation/pull/56) Upgrade to Unicode 10
57
58## 1.3.0
59
60* [#24](https://github.com/unicode-rs/unicode-segmentation/pull/24) Add support for sentence boundaries
61* [#44](https://github.com/unicode-rs/unicode-segmentation/pull/44) Treat `gc=No` as a subset of `gc=N`
62
63## 1.2.1
64
65* [#37](https://github.com/unicode-rs/unicode-segmentation/pull/37):
66 Fix panic in `provide_context`.
67* [#40](https://github.com/unicode-rs/unicode-segmentation/pull/40):
68 Fix crash in `prev_boundary`.
69
70## 1.2.0
71
72* New `GraphemeCursor` API allows random access and bidirectional iteration.
73* Fixed incorrect splitting of certain emoji modifier sequences.
74
75## 1.1.0
76
77* Add `as_str` methods to the iterator types.
78
79## 1.0.3
80
81* Code cleanup and additional tests.
82
83## 1.0.1
84
85* Fix a bug affecting some grapheme clusters containing Prepend characters.
86
87## 1.0.0
88
89* Upgrade to Unicode 9.0.0.
90