Skip to main content

starts_with_case_insensitive

Function starts_with_case_insensitive 

Source
pub fn starts_with_case_insensitive(full_str: &str, partial_str: &str) -> bool
Expand description

Checks if a string starts with another string (case-insensitive).

This function performs a case-insensitive prefix check, handling UTF-8 strings correctly by working with character boundaries rather than byte boundaries.

§Arguments

  • full_str - The string to check
  • partial_str - The prefix to look for

§Returns

Returns true if full_str starts with partial_str (ignoring case), false otherwise.

§Examples

assert!(starts_with_case_insensitive("Hello World", "hello"));
assert!(starts_with_case_insensitive("RPFM", "rpf"));
assert!(!starts_with_case_insensitive("Short", "ThisIsLonger"));