Utils.appendFormat

Overview | Methods | This Package | All Packages

Utils.appendFormat

Appends the specified format string to the buffer using a string array to apply a format.

Syntax

public static void appendFormat( StringBuffer buffer, String format, String[] args )

Parameters

buffer

The StringBuffer object to append the formatted string to.

format

The format string to append.

args

The string array to apply to the format.

Remarks

The format string can contain parameters in the form of "%0" through "%9" that will be replaced by the elements in the args array. It also replaces the percent (%) character with the current locale's list separator.

The following example generates the string "Of left and right, left is better":

StringBuffer sb = new StringBuffer(256);
String format = "Of %0 and %1, %0 is better";
String[] args = { "left", "right" };
appendFormat(sb, format, args);

See Also   format