Logo

Programming-Idioms

History of Idiom 142 > diff from v30 to v31

Edit summary for version 31 by leif:
[Haskell] Remove boilerplate

Version 30

2019-09-26, 20:46:20

Version 31

2019-09-26, 21:09:05

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)
Imports
import Text.Printf (printf)
Code
decToHexString :: Int -> String
decToHexString = printf "%x"

main :: IO ()
main = do
  let s = decToHexString 999
  return ()
Code
s :: String
s = printf "%x" 999