clippy_utils::str_utils

Function camel_case_start_from_idx

Source
pub fn camel_case_start_from_idx(s: &str, start_idx: usize) -> StrIndex
Expand description

Returns StrIndex of the last camel-case component of s[idx..].

assert_eq!(camel_case_start_from_idx("AbcDef", 0), StrIndex::new(0, 0));
assert_eq!(camel_case_start_from_idx("AbcDef", 1), StrIndex::new(3, 3));
assert_eq!(camel_case_start_from_idx("AbcDefGhi", 0), StrIndex::new(0, 0));
assert_eq!(camel_case_start_from_idx("AbcDefGhi", 1), StrIndex::new(3, 3));
assert_eq!(camel_case_start_from_idx("Abcdefg", 1), StrIndex::new(7, 7));