Skip to content

Commit edc8612

Browse files
committed
Merge branch 'djudd-case-folding'
2 parents 4d83a60 + 0b1760e commit edc8612

File tree

4 files changed

+1500
-8
lines changed

4 files changed

+1500
-8
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@ unicode-case-mapping
1818

1919
<br>
2020

21-
Fast mapping of `char` to lowercase, uppercase, or titlecase in Rust using
22-
Unicode 14.0 data.
21+
Fast mapping of a `char` to lowercase, uppercase, titlecase, or its simple case folding
22+
in Rust using Unicode 14.0 data.
2323

2424
Usage
2525
-----
2626

2727
```rust
2828
fn main() {
2929
assert_eq!(unicode_case_mapping::to_lowercase('İ'), ['i' as u32, 0x0307]);
30-
assert_eq!(unicode_case_mapping::to_lowercase('ß'), [0; 2]);
30+
assert_eq!(unicode_case_mapping::to_lowercase('ß'), ['ß' as u32, 0]);
3131
assert_eq!(unicode_case_mapping::to_uppercase('ß'), ['S' as u32, 'S' as u32, 0]);
3232
assert_eq!(unicode_case_mapping::to_titlecase('ß'), ['S' as u32, 's' as u32, 0]);
3333
assert_eq!(unicode_case_mapping::to_titlecase('-'), [0; 3]);
34+
assert_eq!(unicode_case_mapping::case_folded('I'), NonZeroU32::new('i' as u32));
35+
assert_eq!(unicode_case_mapping::case_folded('ß'), None);
36+
assert_eq!(unicode_case_mapping::case_folded('ẞ'), NonZeroU32::new('ß' as u32));
3437
}
3538
```
3639

@@ -41,8 +44,8 @@ The Rust standard library supplies [to_uppercase] and [to_lowercase] methods on
4144
`char` so you might be wondering why this crate was created or when to use it.
4245
You should almost certainly use the standard library, unless:
4346

44-
* You need support for titlecase conversion according to the Unicode character
45-
database (UCD).
47+
* You need support for titlecase conversion or case folding according to the
48+
Unicode character database (UCD).
4649
* You need lower level access to the mapping table data, compared to the iterator
4750
interface supplied by the standard library.
4851
* You _need_ faster performance than the standard library.

0 commit comments

Comments
 (0)