Skip to content

Commit

Permalink
Add toUpper and toLower functions for String
Browse files Browse the repository at this point in the history
  • Loading branch information
david-christiansen committed Feb 5, 2014
1 parent 138d35e commit a4038a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libs/prelude/Prelude/Strings.idr
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,16 @@ unwords = pack . unwords' . map unpack

length : String -> Nat
length = fromInteger . prim__zextInt_BigInt . prim_lenString

toLower : String -> String
toLower x with (strM x)
strToLower "" | StrNil = ""
strToLower (strCons c cs) | (StrCons c cs) =
strCons (toLower c) (toLower (assert_smaller (strCons c cs) cs))

toUpper : String -> String
toUpper x with (strM x)
strToLower "" | StrNil = ""
strToLower (strCons c cs) | (StrCons c cs) =
strCons (toUpper c) (toUpper (assert_smaller (strCons c cs) cs ))

0 comments on commit a4038a3

Please sign in to comment.