Modifier and Type | Method and Description |
---|---|
static String |
formatCount(long count,
int countDigits)
Formats the given
count value to the fixed string length
maxDigitsForCount padding it with spaces from the left if
necessary. |
static int |
writeCountLine(Line line,
long count,
int countDigits,
LineProcessor output)
Writes the given line prefixed with the count using the format
' ' + <count> + ' ' + <line> and using formatCount(long, int) to format <count> . |
public static String formatCount(long count, int countDigits)
count
value to the fixed string length
maxDigitsForCount
padding it with spaces from the left if
necessary. Note that the returned string can be longer than
maxDigitsForCount
as values are never truncated.count
- the count value to formatcountDigits
- the number of digits to use, padding the given value with
spaces from left if necessaryvalue
padded with spaces from the left if necessarypublic static int writeCountLine(Line line, long count, int countDigits, LineProcessor output)
' ' + <count> + ' ' + <line>
formatCount(long, int)
to format <count>
.line
- the line to write to the outputcount
- the count written before the linecountDigits
- the number of digits to use for <count>
, padding the
given value with spaces from left if necessaryoutput
- the output device to write to#formatCount(long, int)
Copyright © 2024. All rights reserved.