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


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

Re: Unmathematical interface (contract) in Java?

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Unmathematical interface (contract) in Java?
Date 2016-10-03 21:03 +0000
Organization A noiseless patient Spider
Message-ID <nsuh39$a4r$1@dont-email.me> (permalink)
References <Java-20161003185250@ram.dialup.fu-berlin.de>

Show all headers | View raw


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       |

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web