[][src]Function phpify::string::stripos

pub fn stripos<H, N>(haystack: H, needle: N, offset: isize) -> Option<usize> where
    H: AsRef<str>,
    N: AsRef<str>, 

Find the position of the first occurrence of a case-insensitive substring in a string.

Description

Find the numeric position of the first occurrence of needle in the haystack string.

Unlike the strpos(), stripos() is case-insensitive.

Parameters

offset

If the offset is negative, the search will start this number of characters counted from the end of the string.

Examples

Example #1 stripos() example

use phpify::string::stripos;

let mystring = "ABC";
let findme = "a";
let pos = stripos(mystring, findme, 0).unwrap();

assert_eq!(pos, 0);