Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Snprintf For Java

DZone's Guide to

Snprintf For Java

·
Free Resource
sprintf and snprintf where things I used to really missing from C. 

Here is a straight forward snprintf implementation.


    public static String snprintf( int size, String format, Object ... args ) {
        StringWriter writer = new StringWriter( size );
        PrintWriter out = new PrintWriter( writer );
        out.printf( format, args );
        out.close();
        return writer.toString();
    }
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}