Crates.io | mask-text |
lib.rs | mask-text |
version | 0.1.2 |
source | src |
created_at | 2022-11-01 20:28:52.843897 |
updated_at | 2022-11-01 22:43:10.209354 |
description | This is a library to mask text with multiple masking options |
homepage | https://github.com/rusty-ferris-club/mask-text |
repository | https://github.com/rusty-ferris-club/mask-text |
max_upload_size | |
id | 703041 |
size | 19,326 |
This is a library to mask text with multiple masking options
[dependencies]
mask-text = { version = "0.1.2" }
fn main() {
// masking 80% of the given text. minimum masking chars should bigger then 3.
let percentage_result = mask_text::Kind::Percentage("text to mask".to_string(), 80, 3, "*".to_string()).mask();
// masking text by regex group.
let re = Regex::new("([a-z].*) (mask) ([a-z].*)").unwrap();
let regex_result = mask_text::Kind::Regex("text to mask on group".to_string(), re, 2, "*".to_string()).mask();
// masking 3 first chars from the string.
let prefix_result = mask_text::Kind::Prefix("text to mask".to_string(), 3, "*".to_string()).mask();
// masking all chars.
let all_result = mask_text::Kind::All("text to mask".to_string(), "*".to_string()).mask()
}
To all Contributors - you make this happen, thanks!
Copyright (c) 2022 @kaplanelad. See LICENSE for further details.