Expand description
§minigrep_cli_tool
A lightweight library module that powers the MiniGrep CLI tool.
It provides two main functions for searching within text:
search(case-sensitive)search_case_insensitive(case-insensitive)
§Examples
use minigrep_cli_tool::{search, search_case_insensitive};
let query = "rust";
let contents = "Rust is fast.\nTrust in Rust.";
// Case-sensitive
let matches: Vec<&str> = search(query, contents).collect();
// Case-insensitive
let matches_insensitive: Vec<&str> = search_case_insensitive(query, contents).collect();Functions§
- search
- Searches for lines containing the query string in the provided text.
- search_
case_ insensitive - Searches for lines containing the query string, ignoring case.