Documentation
¶
Overview ¶
Package conversion is a package of implementations which converts one data structure to another.
Index ¶
- func BinaryToDecimal(binary string) (int, error)
- func DecimalToBinary(num int) (string, error)
- func HEXToRGB(hex uint) (red, green, blue byte)
- func IntToRoman(n int) (string, error)
- func RGBToHEX(red, green, blue byte) (hex uint)
- func Reverse(str string) string
- func RomanToInteger(input string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryToDecimal ¶
BinaryToDecimal() function that will take Binary number as string, and return it's Decimal equivalent as integer.
func DecimalToBinary ¶
DecimalToBinary() function that will take Decimal number as int, and return it's Binary equivalent as string.
func HEXToRGB ¶
HEXToRGB splits an RGB input (e.g. a color in hex format; 0x<color-code>) into the individual components: red, green and blue
func IntToRoman ¶
IntToRoman converts an integer value to a roman numeral string. An error is returned if the integer is not between 1 and 3999.
func RGBToHEX ¶
RGBToHEX does exactly the opposite of HEXToRGB: it combines the three components red, green and blue to an RGB value, which can be converted to e.g. Hex
func RomanToInteger ¶
RomanToInteger converts a roman numeral string to an integer. Roman numerals for numbers outside the range 1 to 3,999 will return an error. Nil or empty string return 0 with no error thrown.
Types ¶
This section is empty.