on master help sign in
Predicates for Prelude Strings
commit97e0778488935359642ad2134cc9c7d211517550 authorHeather <heather@live.ru> dateTue 1 Jul 2014, 08:54 (12 years ago) parented971db
1 file changed+12
libs/prelude/Prelude/Strings.idr+12
libs/prelude/Prelude/Strings.idr+12
@@ -271,4 +271,16 @@ toUpper x with (strM x)
271271 strToLower "" | StrNil = ""
272272 strToLower (strCons c cs) | (StrCons c cs) =
273273 strCons (toUpper c) (toUpper (assert_smaller (strCons c cs) cs ))
274+
275+--------------------------------------------------------------------------------
276+-- Predicates
277+--------------------------------------------------------------------------------
274278
279+isPrefixOf : String -> String -> Bool
280+isPrefixOf a b = isPrefixOf (unpack a) (unpack b)
281+
282+isSuffixOf : String -> String -> Bool
283+isSuffixOf a b = isSuffixOf (unpack a) (unpack b)
284+
285+isInfixOf : String -> String -> Bool
286+isInfixOf a b = isInfixOf (unpack a) (unpack b)