tag | 6a9a6cfdf603f6642f7e127924000fe6d86598af | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Wed Oct 27 09:35:10 2021 -0700 |
object | 0ee26cefa5bf8b09ee506c1dc3fe698630937085 |
Android S V2 Preview 1
commit | 0ee26cefa5bf8b09ee506c1dc3fe698630937085 | [log] [tgz] |
---|---|---|
author | Joel Galenson <jgalenson@google.com> | Tue Aug 24 18:23:55 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Aug 24 18:23:55 2021 +0000 |
tree | 629f0825c5a3b3f7870521f987b6ed3285cf101f | |
parent | ab4c798bfc95938cc01c8ebaf4d7c6b3ece12ed3 [diff] | |
parent | 1fba4247aaeee75b424bc1aa7a0d63c7ecdcf820 [diff] |
Update TEST_MAPPING am: 1fba4247aa Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/unicode-segmentation/+/1804436 Change-Id: Ie5ebc95e8f7c53911e0ca1c99d6a3e37ca581f9f
Iterators which split strings on Grapheme Cluster or Word boundaries, according to the Unicode Standard Annex #29 rules.
use unicode_segmentation::UnicodeSegmentation; fn main() { let s = "a̐éö̲\r\n"; let g = s.graphemes(true).collect::<Vec<&str>>(); let b: &[_] = &["a̐", "é", "ö̲", "\r\n"]; assert_eq!(g, b); let s = "The quick (\"brown\") fox can't jump 32.3 feet, right?"; let w = s.unicode_words().collect::<Vec<&str>>(); let b: &[_] = &["The", "quick", "brown", "fox", "can't", "jump", "32.3", "feet", "right"]; assert_eq!(w, b); let s = "The quick (\"brown\") fox"; let w = s.split_word_bounds().collect::<Vec<&str>>(); let b: &[_] = &["The", " ", "quick", " ", "(", "\"", "brown", "\"", ")", " ", " ", "fox"]; assert_eq!(w, b); }
unicode-segmentation does not depend on libstd, so it can be used in crates with the #![no_std]
attribute.
You can use this package in your project by adding the following to your Cargo.toml
:
[dependencies] unicode-segmentation = "1.8.0"
GraphemeCursor
API allows random access and bidirectional iteration.as_str
methods to the iterator types.