@jossmac/lil-libs
    Preparing search index...

    Function contains

    • Checks whether a string contains another, ignoring diacritics and case.

      Uses Intl.Collator for accent- and case-insensitive matching. An empty substring always matches.

      • string: string

        Haystack to search within (normalized to NFC before comparison).

      • substring: string

        Needle to find; empty string always matches.

      • locale: string = "en"

        Locale for accent- and case-insensitive matching via Intl.Collator. Defaults to "en".

      true when substring appears in string per collator rules; false otherwise.

      contains("café", "cafe"); // true
      contains("Hello World", "world"); // true
      contains("hello", ""); // true (empty needle always matches)
      contains("hello", "bye"); // false