Skip to content

Commit 7a54158

Browse files
committed
add README.md, .travis.yml
1 parent 13ddba0 commit 7a54158

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
11
language: rust
2+
sudo: false
3+
script:
4+
- cargo build --verbose
5+
- cargo test --verbose
6+
- rustdoc --test README.md -L target/debug -L target/debug/deps
7+
- cargo doc
8+
after_success: |
9+
[ $TRAVIS_BRANCH = master ] &&
10+
[ $TRAVIS_PULL_REQUEST = false ] &&
11+
echo '<meta http-equiv=refresh content=0;url=unicode_segmentation/index.html>' > target/doc/index.html &&
12+
pip install ghp-import --user $USER &&
13+
$HOME/.local/bin/ghp-import -n target/doc &&
14+
git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
15+
env:
16+
global:
17+
secure: sF21oZa17vX3iE16x7lt2VsdcSYUJ5PtEwJzQ9Ab/0zFaNc5LUXFUOBddMS9LxYnwO1WI9iOVOYC2NbXT4oRgjZ2cmkatoE6nGHmkqUe4paxVy1Fg6ncjYO1jZwoRSSn1mi0CcwoHq46r2l6FaD0InJExwa3dzk63B9SjIUiekw=
18+
notifications:
19+
email:
20+
on_success: never

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Iterators which split strings on Grapheme Cluster or Word boundaries, according
2+
to the [Unicode Standard Annex #29](http://www.unicode.org/reports/tr29/) rules.
3+
4+
```rust
5+
extern crate unicode_segmentation;
6+
7+
use unicode_segmentation::UnicodeSegmentation;
8+
9+
fn main() {
10+
let s = "a̐éö̲\r\n";
11+
let g = UnicodeSegmentation::graphemes(s, true).collect::<Vec<&str>>();
12+
let b: &[_] = &["", "", "ö̲", "\r\n"];
13+
assert_eq!(g, b);
14+
15+
let s = "The quick (\"brown\") fox can't jump 32.3 feet, right?";
16+
let w = s.unicode_words().collect::<Vec<&str>>();
17+
let b: &[_] = &["The", "quick", "brown", "fox", "can't", "jump", "32.3", "feet", "right"];
18+
assert_eq!(w, b);
19+
20+
let s = "The quick (\"brown\") fox";
21+
let w = s.split_word_bounds().collect::<Vec<&str>>();
22+
let b: &[_] = &["The", " ", "quick", " ", "(", "\"", "brown", "\"", ")", " ", " ", "fox"];
23+
assert_eq!(w, b);
24+
}
25+
```
26+
27+
# crates.io
28+
29+
You can use this package in your project by adding the following
30+
to your `Cargo.toml`:
31+
32+
```toml
33+
[dependencies]
34+
unicode-segmentation = "0.0.1"
35+
```

0 commit comments

Comments
 (0)