case-insensitive-match- A simplified, faster way to do case-insensitive matching.

Safe HaskellSafe-Inferred



This, like most other case-insensitive matching algorithms, is an over-simplification. For some complex Q&A about properties like case, see A round-trip case-conversion does not necessarily result in the original character(s) in some scripts. Also, string matching is not necessarily the same as character matching. The char-at-a-time approach taken here is not technically correct, but works for the most scripts, and definitely for ASCII and the ISO-8859-1 8-bit Latin 1 character set.

Usage is simple:

main = putStrLn $ if "HREF" ^== "href" then "match" else "no match"



(^==) :: CaseInsensitiveEq a => a -> a -> Bool

An equality operator for CaseInsensitiveEq.

(^/=) :: CaseInsensitiveEq a => a -> a -> Bool

An inequality operator for CaseInsensitiveEq.