Documentation ¶
Overview ¶
Package conversion is a package of implementations which converts one data structure to another.
Index ¶
- Constants
- func Base64Decode(input string) []byte
- func Base64Encode(input []byte) string
- 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 ¶
const Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode decodes the received input base64 string into a byte slice. The implementation follows the RFC4648 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc4648#section-4
func Base64Encode ¶
Base64Encode encodes the received input bytes slice into a base64 string. The implementation follows the RFC4648 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc4648#section-4
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.