split-optional

Crates.iosplit-optional
lib.rssplit-optional
version1.0.0
sourcesrc
created_at2022-09-11 17:50:48.007758
updated_at2022-09-11 17:50:48.007758
descriptionIt split from a source `str` to `Option<&'a str>` per an element.
homepage
repositoryhttps://github.com/usagi/split-optional
max_upload_size
id663155
size7,055
Usagi Ito (usagi)

documentation

README

split-optional

It split from a source str to Option<&'a str> per an element.

Usage | Example

fn main()
{
 const SOME_INPUT: &str = "aaa,bbb,ccc";

 // (Some("aaa"), Some("bbb,ccc"))
 let result = split_optional::split2(SOME_INPUT, ",");
 println!("{result:?}");

 // (Some("aaa"), Some("bbb"), Some("ccc"))
 let result = split_optional::split3(SOME_INPUT, ",");
 println!("{result:?}");

 // (Some("aaa"), Some("bbb"), Some("ccc"), None)
 let result = split_optional::split4(SOME_INPUT, ",");
 println!("{result:?}");

 // (Some("aaa"), Some("bbb"), Some("ccc"), None, None)
 let result = split_optional::split5(SOME_INPUT, ",");
 println!("{result:?}");
}

License

Author

Commit count: 1

cargo fmt