Crates.io | split-optional |
lib.rs | split-optional |
version | 1.0.0 |
source | src |
created_at | 2022-09-11 17:50:48.007758 |
updated_at | 2022-09-11 17:50:48.007758 |
description | It split from a source `str` to `Option<&'a str>` per an element. |
homepage | |
repository | https://github.com/usagi/split-optional |
max_upload_size | |
id | 663155 |
size | 7,055 |
It split from a source str
to Option<&'a str>
per an element.
cargo run --examples a
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:?}");
}