In this example let us use the Power Shell format operator to turn a base 10 number into a Hexadecimal number. The command is as follows:
"0X{0:X}" -f 21
What the above command does is turns number 21 into an uppercase Hexadecimal number as follows:
0X15
If you prefer lowercase Hexadecimal numbers instead then you can use the below command:
"0x{0:x}" -f 21
The -f operator is actually the shorthand method of the System.String class’s Format method.