SourceForge.net Logo
Version: 0.27 - Last update: 2004-05-30 Home Page - SourceForge Project Page - Contact

Jodd
  Overview
  News
  Download
  License
  References

Development
  Using Jodd
  Javadoc
  JUnit report

Community
  Contribute
  Report a bug

More reading
  Milestone 0.30



Top 25%

BSD
 

Format.sprintf()

Who remembers C and sprintf()? It would be great to have something like sprintf() in Java. Jodd provides Format.sprintf() that works similary to standard C function sprintf(). It seems it works faster and it is easier to use than similar Sun solution.

Bellow are just few usage examples:

Format examples
 
Format.sprintf("%d", 1);
Format.sprintf("%+i", 173);
Format.sprintf("%+x", 173);
Format.sprintf("%04d", 1);
Format.sprintf("%-+4d", -1);
Format.sprintf("%s %s", new String[]{"q", "w"});
Format.sprintf("%4.2f", 1.7);

More examples can be found in Junit tests.


http://jodd.sourceforge.net
najgor at users.sourceforge.net