• Home
Name Date Size #Lines LOC

..--

benches/04-Jul-2025-158119

scripts/04-Jul-2025-681502

src/04-Jul-2025-5,5654,610

tests/04-Jul-2025-2,7292,650

.android-checksum.jsonD04-Jul-20251.9 KiB11

.cargo-checksum.jsonD04-Jul-20251.5 KiB11

Android.bpD04-Jul-2025892 3228

COPYRIGHTD04-Jul-2025321 87

Cargo.tomlD04-Jul-20251.6 KiB7868

LICENSED04-Jul-202510.6 KiB202169

LICENSE-APACHED04-Jul-202510.6 KiB202169

METADATAD04-Jul-2025504 1817

MODULE_LICENSE_APACHE2D04-Jul-20250

README.mdD04-Jul-20254.7 KiB12381

TEST_MAPPINGD04-Jul-20251,001 4746

cargo_embargo.jsonD04-Jul-202551 44

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://github.com/unicode-rs/unicode-segmentation/actions/workflows/rust.yml/badge.svg)](https://github.com/unicode-rs/unicode-segmentation/actions/workflows/rust.yml)
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 = s.graphemes(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.10.1"
42```
43
44# Change Log
45
46## 1.11.0
47* [#124](https://github.com/unicode-rs/unicode-segmentation/pull/124) Update data to Unicode 15.1
48* [#128](https://github.com/unicode-rs/unicode-segmentation/pull/128) Add `size_hint` to iterators
49
50## 1.10.1
51* [#113](https://github.com/unicode-rs/unicode-segmentation/pull/113) Use criterion.rs for word benchmarks
52* [#112](https://github.com/unicode-rs/unicode-segmentation/pull/112) Improve table search speed through lookups
53
54## 1.10.0
55* [#107](https://github.com/unicode-rs/unicode-segmentation/pull/107) Upgrade to Unicode 15.0.0
56* [#104](https://github.com/unicode-rs/unicode-segmentation/pull/104) Supersedes and fixes [#75](https://github.com/unicode-rs/unicode-segmentation/pull/75)
57
58## 1.9.0
59* [#101](https://github.com/unicode-rs/unicode-segmentation/pull/101) Upgrade to Unicode 14.0.0
60
61## 1.8.0
62* [#100](https://github.com/unicode-rs/unicode-segmentation/pull/100) * [#100](https://github.com/unicode-rs/unicode-segmentation/pull/100) - Increase `#[inline]` opportunities, resulting in 15-40% performance improvement.
63* [#95](https://github.com/unicode-rs/unicode-segmentation/pull/98) Implement debug for Graphemes
64* [#94](https://github.com/unicode-rs/unicode-segmentation/pull/94) Add Initial fuzzer for oss-fuzz integration
65* [#93](https://github.com/unicode-rs/unicode-segmentation/pull/93) Fix  unused imports and deprecated pattern warnings
66* [#91](https://github.com/unicode-rs/unicode-segmentation/pull/92) Made local variable immutable by moving it into loop
67* [#91](https://github.com/unicode-rs/unicode-segmentation/pull/91) Add new iterator [UnicodeWordIndices](https://unicode-rs.github.io/unicode-segmentation/unicode_segmentation/struct.UnicodeWordIndices.html) and [unicode_word_indices](https://unicode-rs.github.io/unicode-segmentation/unicode_segmentation/trait.UnicodeSegmentation.html#tymethod.unicode_word_indices)
68
69## 1.7.1
70
71* Update docs on version number
72
73## 1.7.0
74
75* [#87](https://github.com/unicode-rs/unicode-segmentation/pull/87) Upgrade to Unicode 13
76* [#79](https://github.com/unicode-rs/unicode-segmentation/pull/79) Implement a special-case lookup for ascii grapheme categories
77* [#77](https://github.com/unicode-rs/unicode-segmentation/pull/77) Optimization for grapheme iteration
78
79## 1.6.0
80
81* [#72](https://github.com/unicode-rs/unicode-segmentation/pull/72) Upgrade to Unicode 12
82
83## 1.5.0
84
85* [#68](https://github.com/unicode-rs/unicode-segmentation/pull/68) Upgrade to Unicode 11
86
87## 1.4.0
88
89* [#56](https://github.com/unicode-rs/unicode-segmentation/pull/56) Upgrade to Unicode 10
90
91## 1.3.0
92
93* [#24](https://github.com/unicode-rs/unicode-segmentation/pull/24) Add support for sentence boundaries
94* [#44](https://github.com/unicode-rs/unicode-segmentation/pull/44) Treat `gc=No` as a subset of `gc=N`
95
96## 1.2.1
97
98* [#37](https://github.com/unicode-rs/unicode-segmentation/pull/37):
99  Fix panic in `provide_context`.
100* [#40](https://github.com/unicode-rs/unicode-segmentation/pull/40):
101  Fix crash in `prev_boundary`.
102
103## 1.2.0
104
105* New `GraphemeCursor` API allows random access and bidirectional iteration.
106* Fixed incorrect splitting of certain emoji modifier sequences.
107
108## 1.1.0
109
110* Add `as_str` methods to the iterator types.
111
112## 1.0.3
113
114* Code cleanup and additional tests.
115
116## 1.0.1
117
118* Fix a bug affecting some grapheme clusters containing Prepend characters.
119
120## 1.0.0
121
122* Upgrade to Unicode 9.0.0.
123