Logo

Programming-Idioms

History of Idiom 142 > diff from v19 to v20

Edit summary for version 20 by mrkeen:
New Haskell implementation by user [mrkeen]

Version 19

2019-01-24, 10:30:51

Version 20

2019-09-26, 13:55:30

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Extra Keywords
hex hexa radix
Extra Keywords
hex hexa radix
Imports
import Text.Printf (printf)
Code
decToHexString :: Int -> String
decToHexString = printf "%x"

main :: IO ()
main = do
  let s = decToHexString 999
  return ()