FileDocCategorySizeDatePackage
StringFormatTest.javaAPI DocExample982Sun Apr 29 14:41:54 BST 2001None

StringFormatTest

public class StringFormatTest extends Object

Fields Summary
Constructors Summary
Methods Summary
private static voiddump(int format, java.lang.String s)

		System.out.print((char)format);
		System.out.print(" ==> \"");
		System.out.print(s);
		System.out.print('"");
		System.out.println();
	
public static voidmain(java.lang.String[] argv)
Simple test cases; try even and odd lengths

		String[] mesg = {"JavaFun", "JavaFun!" };
		for (int i=0; i<mesg.length; i++) {
			System.out.println("Input String " + mesg[i]);
			dump(JUST_LEFT,
				new StringFormat(5, StringFormat.JUST_LEFT).format(mesg[i]));
			dump(JUST_LEFT,
				new StringFormat(10, StringFormat.JUST_LEFT).format(mesg[i]));
			dump(JUST_CENTER,
				new StringFormat(5, StringFormat.JUST_CENTER).format(mesg[i]));
			dump(JUST_CENTER,
				new StringFormat(10, StringFormat.JUST_CENTER).format(mesg[i]));
			dump(JUST_RIGHT,
				new StringFormat(5, StringFormat.JUST_RIGHT).format(mesg[i]));
			dump(JUST_RIGHT,
				new StringFormat(10, StringFormat.JUST_RIGHT).format(mesg[i]));
		}