mirror of
https://github.com/openharmony/third_party_rust_unicode-width.git
synced 2026-07-18 13:18:15 -04:00
add travis, README, update Cargo.toml
This commit is contained in:
@@ -0,0 +1 @@
|
||||
language: rust
|
||||
+14
@@ -1,4 +1,18 @@
|
||||
[package]
|
||||
|
||||
name = "unicode_width"
|
||||
version = "0.0.1"
|
||||
authors = ["kwantam <kwantam@gmail.com>"]
|
||||
|
||||
homepage = "https://github.com/unicode-rs/unicode_width"
|
||||
repository = "https://github.com/unicode-rs/unicode_width"
|
||||
documentation = "https://unicode-rs.github.io/unicode_width/unicode_width"
|
||||
license = "MIT/Apache-2.0"
|
||||
keywords = ["text", "width", "unicode"]
|
||||
readme = "README.md"
|
||||
description = """
|
||||
Determine displayed width of `char` and `str` types
|
||||
according to Unicode Standard Annex #11 rules.
|
||||
"""
|
||||
|
||||
exclude = [ "target/*", "Cargo.lock" ]
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# unicode_width
|
||||
|
||||
Determine displayed width of `char` and `str` types according to
|
||||
[Unicode Standard Annex #11](http://www.unicode.org/reports/tr11/)
|
||||
rules.
|
||||
|
||||
[](https://travis-ci.org/unicode-rs/unicode_width)
|
||||
|
||||
```rust
|
||||
extern crate unicode_width;
|
||||
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
fn main() {
|
||||
let teststr = "Hello, world!";
|
||||
let width = UnicodeWidthStr::width(teststr);
|
||||
println!("{}", teststr);
|
||||
println!("The above string is {} columns wide.", width);
|
||||
let width = teststr.width_cjk();
|
||||
println!("The above string is {} columns wide (CJK).", width);
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](http://unicode-rs.github.io/unicode_width/unicode_width/)
|
||||
Reference in New Issue
Block a user