Class NumberToStringConverter
Object
NumberToStringConverter
Converts a number to a strings of constant width by padding with leading zeros.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionNumberToStringConverter
(int maxNumberToRepresent) Creates with a constant width just enough to be able to representmaxNumberToRepresent
. -
Method Summary
-
Constructor Details
-
NumberToStringConverter
public NumberToStringConverter(int maxNumberToRepresent) Creates with a constant width just enough to be able to representmaxNumberToRepresent
.- Parameters:
maxNumberToRepresent
- the maximimal number that needs to be converted.
-
-
Method Details
-
convert
Convertsnumber
to a string, padding with leading zeros if necessary to ensure the desired width.- Parameters:
number
- the number to convert to a string- Returns:
- the string representation of
number
, maybe padded with leading zeros
-