Monday 6 June 2016

Haskell: Convert every character in string to uppercase

Following statement converts every character in string to uppercase.

getUpper list = [toUpper x | x <- list ]
Prelude> import Data.Char
Prelude Data.Char> 
Prelude Data.Char> let getUpper list = [toUpper x | x <- list ]
Prelude Data.Char> 
Prelude Data.Char> getUpper "Hello ptr, How are you"
"HELLO PTR, HOW ARE YOU"


Previous                                                 Next                                                 Home

No comments:

Post a Comment