
22 Feb
2015
22 Feb
'15
7:38 p.m.
On 2015-02-22 19:50, Roelof Wobben wrote:
Now im facing this problem.
There is a log file of strings.
Most of them are of this format char Number [chars]
What is the best way to check if the string has this format ?
For this particular format I'd go for plain pattern matching and guards. Something like import Data.Char (isLetter, isDigit) isValid :: String -> Bool isValid s = go (words s) where go ([a]:b:_) = isLetter a && all isDigit b go _ = False This will accept lines starting with a letter followed by some number and then (optionally!) some more text. -- Frerich Raabe - raabe@froglogic.com www.froglogic.com - Multi-Platform GUI Testing