pub fn slice_string_between(str: &String, end: &str) -> Option<String>Expand description
Extracts a substring from the beginning of the given string up to the first occurrence of the specified delimiter.
§Arguments
str- A reference to the string to be processed.end- The delimiter string to search for.
§Returns
An Option<String> containing the substring from the start of the string up to the delimiter, or None if the delimiter is not found.
§Examples
use rust_string_utils::slice_string_between;
let str = String::from("hello world");
let result = slice_string_between(&str, " ");
assert_eq!(result, Some("hello".to_string()));