String::split_onceSplit this string on the first occurrence of needle, and return
the text before and after needle.
Examples"abcd".split_once("b") //-> Some(["a", "cd"])
Source Codepublic method split_once(this: String, needle: String): Option<(String, String)> {
match this.index_of(needle) {
None => None
Some(i) => {
Some((
this.substring(0, i),
this.substring(i + needle.len(), this.len()),
))
}
}
}