Function rufl::string::index_all

source ·
pub fn index_all(
    s: impl AsRef<str>,
    search: &str,
    position: usize
) -> Vec<usize>
Expand description

Searches a string and returns all the indexs of the occurrence of the specified searched substring.

§Arguments

  • s - The input string where to search.
  • search - The substring to search for.
  • position - The position to start searching.

§Returns

Returns index of the first occurrence of searched substring.

§Examples

use rufl::string;

assert_eq!(vec![2, 3], string::index_all("hello", "l", 0));

assert_eq!(vec![0, 2], string::index_all("你好你好!", "你好", 0));