Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn search<'a>(query: &str, contents: &'a str) -> Vec<String> {
- let mut results = Vec::new();
- for (lineno, line) in contents.lines().enumerate() {
- if line.contains(query) {
- let sTemp: String = lineno.to_string();
- results.push(sTemp.push_str(line));
- }
- }
- return results;
Add Comment
Please, Sign In to add comment