RosettaCodeData/Task/Substring/Haskell/substring-1.hs

4 lines
114 B
Haskell
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
t45 n c s | null sub = []
| otherwise = take n. head $ sub
where sub = filter(isPrefixOf c) $ tails s