mirror of
https://github.com/rwinkhart/convertroman.git
synced 2026-09-05 16:37:22 -04:00
simplified inttobytes
This commit is contained in:
+2
-4
@@ -64,10 +64,8 @@ func IntToString(input int) (string, error) {
|
|||||||
// IntToBytes converts an integer value to a roman numeral byte array. An error is
|
// IntToBytes converts an integer value to a roman numeral byte array. An error is
|
||||||
// returned if the integer is not between 1 and 3999.
|
// returned if the integer is not between 1 and 3999.
|
||||||
func IntToBytes(input int) ([]byte, error) {
|
func IntToBytes(input int) ([]byte, error) {
|
||||||
if outOfBounds(input) {
|
str, err := IntToString(input)
|
||||||
return nil, IntegerOutOfBounds
|
return []byte(str), err
|
||||||
}
|
|
||||||
return []byte(intToRoman(input)), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// outOfBounds checks to ensure an input value is valid for roman numerals without the need of
|
// outOfBounds checks to ensure an input value is valid for roman numerals without the need of
|
||||||
|
|||||||
Reference in New Issue
Block a user