mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 02:39:20 +00:00
Update str.rs
This commit is contained in:
parent
f604338d99
commit
f86a449846
1 changed files with 4 additions and 0 deletions
|
@ -209,6 +209,10 @@ impl Str {
|
|||
}
|
||||
Str::rc(&ret)
|
||||
}
|
||||
|
||||
pub fn find_sub<'a>(&self, pats: &[&'a str]) -> Option<&'a str> {
|
||||
pats.iter().find(|&&pat| self.contains(pat)).copied()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue