This is the interface used to
build a
Justification from a
String.
It therefore expects the following format:
<filler><alignment><width>[<mode>]
The segments have the following meaning:
| segment |
pattern |
meaning |
<filler> |
. |
character used to fill up with |
<alignment> |
[+-~] |
align to the right(+), left(-) or centered(~) |
<with> |
[0-9]+ |
if the length of the string to justify is less
than this width, the string will be expanded using the filler according to the alignment. |
<mode> |
[|] |
if the mode is truncate(|) then the string will be truncated if its length is greater than <with>
so the result will always have the length of <with>. Please note that truncate can remove valuable
information or cause wrong results (e.g. "10000" with a justification of " +3|" will result in "100"). |
Examples:
| value |
justification |
result |
42 |
0+4 |
0042 |
42 |
.-4 |
42.. |
42 |
_~11 |
____42_____ |
Hello World |
_+5 |
Hello World |
Hello World |
_+5| |
Hello |