hello_closures

Function search

Source
pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str>
Expand description

这是一个字符串搜索方法

§Example

let query = "name";
let contents = "
My Name is Jeff,
The City is named \"山城\"
";
let result = hello_closures::search(query, contents);
assert_eq!(
    result,
    [
        "The City is named \"山城\"",
    ]
)