ZVON > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | >> List << | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Module: List
Function: isPrefixOf
Type: Eq a => [a] -> [a] -> Bool
Description: isPrefixOf and isSuffixOf check whether the first argument is a prefix (resp. suffix) of the second argument.
Related: isSuffixOf

Example 1

Input: isPrefixOf [1,2,3] [1,2,3,4,5]

Output: True

Example 2

Input: isPrefixOf [2,3,4] [1,2,3,4,5]

Output: False

Example 3

Input: isPrefixOf [] [1,2,3,4,5]

Output: True

Example 4

Input: isPrefixOf "xyz" "xyzXYZ"

Output: True