Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35703 > unrolled thread

Re: Unmathematical interface (contract) in Java?

Started byMartin Gregorie <martin@address-in-sig.invalid>
First post2016-10-03 21:03 +0000
Last post2016-10-03 21:03 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Unmathematical interface (contract) in Java? Martin Gregorie <martin@address-in-sig.invalid> - 2016-10-03 21:03 +0000

#35703 — Re: Unmathematical interface (contract) in Java?

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2016-10-03 21:03 +0000
SubjectRe: Unmathematical interface (contract) in Java?
Message-ID<nsuh39$a4r$1@dont-email.me>
On Mon, 03 Oct 2016 18:01:30 +0000, Stefan Ram wrote:

> Dr. E. F. Codd wrote about mathematics:
> 
>       "A special concern is that of avoiding the need for special
>       treatment of special cases except when absolutely necessary.".
> 
>   In Java, to print »s« indented by »n« spaces (assuming we are at the
>   start of a new line), one can write:
> 
> java.lang.System.out.printf ( "%" +( n > 0 ? n : "" )+ "s%s%n", "", s );
> 
>   . Yes, you can write "%2s" or "%1s", but "%0s" is not allowed! Now,
>   how unmathematical is this!
>
Preceding the width with a hyphen '-' left-justifies the value within the 
given field width, e.g.

   System.out.printf("%-6d", s);

though, of course, no justification is seen if the length of the value 
equals or exceeds the stated field width. Since K&R C and (presumably) 
all Java versions.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web