Crates.io | local_strtools |
lib.rs | local_strtools |
version | 0.1.1 |
source | src |
created_at | 2024-07-27 13:44:08.415961 |
updated_at | 2024-07-27 13:46:11.195645 |
description | Collection of string related utilities |
homepage | |
repository | |
max_upload_size | |
id | 1317316 |
size | 2,565 |
strtools
is a collection of string related utilities, not provided by standart
library. Especially useful when your project deals with lot of manipulations
around String
or &str
Pads a string with zeros, resulted string would be in length given in second argument
let str = String::from("9");
let padded_string = strtools::pad(str, 3);
assert_eq!(padded_string, "009");
When length of given string is bigger than the wanted to be length, program panics:
#[should_panic]
fn can_panic() {
let str = String::from("98798");
strtools::pad(str, 3);
}