Hi everyone, Im new to haskell and finding it quite hard to pickup as im a C/C++ programmer however, im sticking with it as i think its a good thing to know. I have a problem were i have the user input a string, i then want to disregard the punctuation marks and spaces and change the case of the string to lower case. I was thinking that with the case i could work out the difference of the capital 'A' and the small 'a' and then change them somehow? As for ignoring punctuation marks and spaces im clueless. Thanks for any help Daniel -- View this message in context: http://www.nabble.com/Ignoring-input-t1422239.html#a3833983 Sent from the Haskell - Haskell forum at Nabble.com.
Hello, Data.Char has functions for converting upper/lower case, and for testing if a character is alpha numeric. http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Char.html If you combine these with the map and filter functions you should be able to get it worked out: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html You probably want to attack it as two steps: (1) remove unwanted characters (2) convert to lower case Jeremy Shaw. ps. Remember that String is just an alias for [Char] in haskell. At Sun, 9 Apr 2006 16:59:19 -0700 (PDT), UnfitElf wrote:
Hi everyone,
Im new to haskell and finding it quite hard to pickup as im a C/C++ programmer however, im sticking with it as i think its a good thing to know.
I have a problem were i have the user input a string, i then want to disregard the punctuation marks and spaces and change the case of the string to lower case.
I was thinking that with the case i could work out the difference of the capital 'A' and the small 'a' and then change them somehow? As for ignoring punctuation marks and spaces im clueless.
Thanks for any help Daniel -- View this message in context: http://www.nabble.com/Ignoring-input-t1422239.html#a3833983 Sent from the Haskell - Haskell forum at Nabble.com.
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
participants (2)
-
Jeremy Shaw -
UnfitElf