oblac / jodd

Jodd! Lightweight. Java. Zero dependencies. Use what you like.
https://jodd.org
BSD 2-Clause "Simplified" License
4.06k stars 723 forks source link

No support for short or byte types in the jodd.format.PrintfFormat class #60

Closed jdstroy closed 10 years ago

jdstroy commented 10 years ago

I don't see any short or byte types for jodd-core's jodd.format.PrintfFormat class.

I am looking to convert some code from another printf implementation to jodd-core; the other implementation supports byte and short, but jodd does not (it is implicitly cast into an integer and formatted as such).

igr commented 10 years ago

I believe that you basically want unsigned byte and short value to be printed like in following test:

    byte b = -128;
    assertEquals("-128", Printf.str("%i", b));
    assertEquals("255", Printf.str("%u", b));

You are right, this test is currently failing. We will solve this!

jdstroy commented 10 years ago

Spot on. :)

igr commented 10 years ago

Sorry for longer response, was away from the net.

jdstroy commented 10 years ago

Sweet, thanks! And no problem, I was fiddling with it a little, too.