This is not a bug. Here is what the PatternLayout documentation says:
This behavior can be changed using the maximum field width modifier which is
designated by a period followed by a
decimal constant. If the data item is longer than the maximum field, then the extra
characters are removed from the
beginning of the data item and not from the end. For example, it the maximum field
width is eight and the data item is ten characters long, then the first two characters
of the data item are dropped. This behavior deviates from the printf function in C
where truncation is done from the end.
Does that make it any clearer? Ceki
At 14:52 05.04.2001 +0000, Frank-Olaf Lohmann DC wrote:
>Hello all,
>
>following is a patch that corrects the formatting behaviour of the '-' switch if the
>string is longer than the maximum field length.
>Current behaviour is the rightmost characters are displayed, as without the '-'
>switch.
>Expected behaviour is the leftmost character are displayed.
>
>--- PatternConverter.java.old Thu Dec 14 21:06:50 2000
>+++ PatternConverter.java Thu Apr 05 14:39:08 2001
>@@ -64,7 +64,12 @@
> int len = s.length();
>
> if(len > max)
>- sbuf.append(s.substring(len-max));
>+ if(leftAlign) {
>+ sbuf.append(s.substring(0, max));
>+ }
>+ else {
>+ sbuf.append(s.substring(len-max));
>+ }
> else if(len < min) {
> if(leftAlign) {
> sbuf.append(s);
>
>
>Regards
>Frank-Olaf Lohmann
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü Web: http://qos.ch
email: [EMAIL PROTECTED] or [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]