local_strtools

Crates.iolocal_strtools
lib.rslocal_strtools
version0.1.1
sourcesrc
created_at2024-07-27 13:44:08.415961
updated_at2024-07-27 13:46:11.195645
descriptionCollection of string related utilities
homepage
repository
max_upload_size
id1317316
size2,565
Javohir (javohir-abdusattorov)

documentation

README

String tools

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

Examples

let str = String::from("9");
let padded_string = strtools::pad(str, 3);

assert_eq!(padded_string, "009");

Panics

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);
}
Commit count: 0

cargo fmt