diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-12-02 17:36:33 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-12-02 19:45:44 +0800 |
| commit | d7ff9b456eac35226b6cf06f8c559c7d06eb178b (patch) | |
| tree | 97a7bfc3c8ad7ecc1f141d9add68198e389e22bf /2025/read.rs | |
| parent | 5fe16ec445653ad3d8fe696ad29d388b66475069 (diff) | |
new: day 2
Diffstat (limited to '2025/read.rs')
| -rw-r--r-- | 2025/read.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/2025/read.rs b/2025/read.rs index a53a3a3..ebd41bd 100644 --- a/2025/read.rs +++ b/2025/read.rs @@ -1,9 +1,9 @@ -use std::{fs, path::Path}; +use std::{fs, path::Path, str::pattern::Pattern}; -pub fn read(file: impl AsRef<Path>) -> Vec<String> { +pub fn read(file: impl AsRef<Path>, p: impl Pattern) -> Vec<String> { fs::read_to_string(file) .expect("Failed to read file") - .lines() + .split(p) .map(|l| l.to_string()) .collect() } |
