full2half 0.1.1

Library and CLI for converting full-width characters to half-width characters and vice versa.
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented1 out of 6 items with examples
  • Size
  • Source code size: 46.53 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.47 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 23s Average build duration of successful builds.
  • all releases: 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • pSchwietzer/full2half
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pSchwietzer

Full2Half

A simple project to allow conversion of full-width characters to half-width characters and vice versa, which supplies a library and CLI binary.

Command-Line Interface

The binary has three main functions.

Convert a string directly:

full2half "Hello World!"

Do the conversion on a file by overwriting or copying:

This will overwrite the file.

full2half -f "file_to_convert.txt"

This will create a copy with this naming scheme: "[File Name] ([Duplicate Counter])[ext]"

full2half -c -f "file_to_convert.txt"

Customize Behaviour:

If needed you can also ignore specific characters like so:

full2half -i "" "" -- "Hello World!"

Or ignore specific character sets by using the specified flags, get more info by running:

full2half -h

Installation

To use this library in your Rust project, simply add the following line to your Cargo.toml file:

[dependencies]
full2half = { version = "0.1.0" }

To install the full2half binary locally, simply run the following command:

cargo install full2half

The binary will be downloaded from crates.io and compiled by cargo. After installation you can simply use the full2half binary from the command line.

Usage

Simply import the CharacterWidth trait and you are ready to go:

use full2half::CharacterWidth;

let full_width_string = "Hello World!";
let half_width_string = "Hello World!";

println!("{}", full_width_string.to_half_width());
println!("{}", half_width_string.to_full_width());

See more details in the docs.

Character References

Wikipedia Unicode

Contribution

If you find any missing characters, conversion errors, bugs or want to extend functionality feel free to do a merge request.

License

This library is licensed under the MIT license. See the LICENSE file for details.