8 lines
161 B
Rust
8 lines
161 B
Rust
|
pub fn str_str(haystack: String, needle: String) -> i32 {
|
||
|
if needle.is_empty() {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
haystack.find(&needle).map(|n| n as i32).unwrap_or(-1)
|
||
|
}
|