Today I'm folding the other way around. I've chosen not to validate the number format because I didn't want to spend the entire evening building a regex that matched all possible formats I can think of.
import Data.Char (isDigit) hide_nums :: String -> String hide_nums = snd . foldr kevin (0, "") where kevin :: Char -> (Int, String) -> (Int, String) kevin char (x, result) | x >= 6 = (x, char:result) | isDigit char = (x + 1, 'x':result) | otherwise = (x, char:result)
There no package for phone numbers?
Using a library kinda defeats the purpose of these exercises, don't you think?
But what's the fun in that?
Yes I'm just asking 😄 of there are one I'll use it, working with phone number is a bit hardwork since others country had different types phone code.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Today I'm folding the other way around. I've chosen not to validate the number format because I didn't want to spend the entire evening building a regex that matched all possible formats I can think of.
There no package for phone numbers?
Using a library kinda defeats the purpose of these exercises, don't you think?
But what's the fun in that?
Yes I'm just asking 😄 of there are one I'll use it, working with phone number is a bit hardwork since others country had different types phone code.