summaryrefslogtreecommitdiff
path: root/find-the-index-of-the-first-occurrence-in-a-string/src/main.rs
blob: 51de786b6f4af3717ab0157e96aaf0c77f49d86b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn main() {
    println!("Hello, world!");
}

struct Solution;

impl Solution {
    pub fn str_str(haystack: String, needle: String) -> i32 {
        match haystack.find(&needle) {
            None => -1,
            Some(e) => e as i32
        }
    }
}