Movatterモバイル変換


[0]ホーム

URL:


Crateunicode_width [][src]

Determine displayed width ofchar andstr types according toUnicode Standard Annex #11rules.

externcrateunicode_width;useunicode_width::UnicodeWidthStr;fnmain() {letteststr="Hello, world!";letwidth=UnicodeWidthStr::width(teststr);println!("{}",teststr);println!("The above string is {} columns wide.",width);letwidth=teststr.width_cjk();println!("The above string is {} columns wide (CJK).",width);}

features

unicode-width supports ano_std feature. This eliminates dependenceon std, and instead uses equivalent functions from core.

crates.io

You can use this package in your project by adding the followingto yourCargo.toml:

[dependencies]unicode-width = "0.1.1"

Constants

UNICODE_VERSION

The version ofUnicodethat this version of unicode-width is based on.

Traits

UnicodeWidthChar

Methods for determining displayed width of Unicode characters.

UnicodeWidthStr

Methods for determining displayed width of Unicode strings.

Keyboard shortcuts

?
Show this help dialog
S
Focus the search field
Move up in search results
Move down in search results
Go to active search result

Search tricks

Prefix searches with a type followed by a colon (e.g.fn:) to restrict the search to a given type.

Accepted types are:fn,mod,struct,enum,trait,typedef (ortdef).

Search functions by type signature (e.g.vec -> usize)


[8]ページ先頭

©2009-2025 Movatter.jp