Expand description
§Full2Half
A simple library for converting full-width characters to half-width characters and vice versa.
§References
§Basic Example
This is the most basic use case, where no customization is needed.
use full2half::CharacterWidth;
let full_width_string = "Hello World!";
let half_width_string = "Hello World!";
assert_eq!(full_width_string.to_half_width(), half_width_string);
assert_eq!(half_width_string.to_full_width(), full_width_string);
§Extended Example
Furthermore this library allows to customize which charactersets and specific characters to ignore.
use full2half::CharacterWidth;
let full_width_string = "Hello World!";
let expected_string = "Hello World!";
let ignore = vec!["!", "e"];
assert_eq!(full_width_string.to_half_width_ext(ignore, true, true, true, false).unwrap(), expected_string);
Traits§
- Trait for converting full-width characters to half-width characters and vice versa.