lowercase/uppercase

This commit is contained in:
Simon Michael 2008-11-27 06:32:31 +00:00
parent 0c4cf88578
commit 77098fec7e
2 changed files with 6 additions and 3 deletions

View File

@ -127,7 +127,7 @@ fixSmartDateStr :: Day -> String -> String
fixSmartDateStr t s = printf "%04d/%02d/%02d" y m d fixSmartDateStr t s = printf "%04d/%02d/%02d" y m d
where where
(y,m,d) = toGregorian $ fixSmartDate t sdate (y,m,d) = toGregorian $ fixSmartDate t sdate
sdate = fromparse $ parsewith smartdate $ map toLower s sdate = fromparse $ parsewith smartdate $ lowercase s
-- | Convert a SmartDate to an absolute date using the provided reference date. -- | Convert a SmartDate to an absolute date using the provided reference date.
fixSmartDate :: Day -> SmartDate -> Day fixSmartDate :: Day -> SmartDate -> Day
@ -283,8 +283,8 @@ months = ["january","february","march","april","may","june",
mons = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"] mons = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"]
monthIndex s = maybe 0 (+1) $ (map toLower s) `elemIndex` months monthIndex s = maybe 0 (+1) $ (lowercase s) `elemIndex` months
monIndex s = maybe 0 (+1) $ (map toLower s) `elemIndex` mons monIndex s = maybe 0 (+1) $ (lowercase s) `elemIndex` mons
month :: Parser SmartDate month :: Parser SmartDate
month = do month = do

View File

@ -42,6 +42,9 @@ import Text.ParserCombinators.Parsec
-- strings -- strings
lowercase = map toLower
uppercase = map toUpper
strip = dropspaces . reverse . dropspaces . reverse strip = dropspaces . reverse . dropspaces . reverse
where dropspaces = dropWhile (`elem` " \t") where dropspaces = dropWhile (`elem` " \t")