11 lines
279 B
Rust
11 lines
279 B
Rust
use regex::Regex;
|
|
|
|
impl Solution {
|
|
pub fn str_str(haystack: String, needle: String) -> i32 {
|
|
let re = Regex::new(needle.as_str()).unwrap();
|
|
match re.find(haystack.as_str()){
|
|
Some(mat) => mat.start() as i32,
|
|
None => -1
|
|
}
|
|
}
|
|
} |