September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
13
Task/URL-decoding/Haskell/url-decoding-2.hs
Normal file
13
Task/URL-decoding/Haskell/url-decoding-2.hs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import Data.Char (chr)
|
||||
import Data.List.Split (splitOn)
|
||||
|
||||
deCode :: String -> String
|
||||
deCode url =
|
||||
let ps = splitOn "%" url
|
||||
in concat $
|
||||
head ps :
|
||||
((\(a, b) -> (chr . read) (mappend "0x" a) : b) <$> (splitAt 2 <$> tail ps))
|
||||
|
||||
-- TEST ------------------------------------------------------------------------
|
||||
main :: IO ()
|
||||
main = putStrLn $ deCode "http%3A%2F%2Ffoo%20bar%2F"
|
||||
Loading…
Add table
Add a link
Reference in a new issue