java.lang.String.format

冰山一角:
String.format("%1$03d", 1)


public void testTwo(){
		Properties pros = System.getProperties();
		/*Enumeration enumeration = pros.propertyNames();
		while(enumeration.hasMoreElements()){
			System.out.println(enumeration.nextElement());
		}*/
		Set<String> sets = pros.stringPropertyNames();
		Iterator<String> it = sets.iterator();
		int num = 1;
		while(it.hasNext()){
			System.out.println(String.format("%1$03d", num) + " : " + it.next());
			num++;
		}
	}

你可能感兴趣的:(java,String,format)