java String.Format() 格式化字符串输出

输出指定格式的字符串:

	public String toString() {
		MessageFormat format = new MessageFormat(
		"bankcode: {0}, serverid: {1},date: {2}, billno: {3}, amount: {4}, merchantUrl: {5}, paypath: {6}");
		return format.format(new String[]{bankcode,serverid,date,billno,amount,merchantUrl,paypath});
	}
 

输出为:

 bankcode: XXX, serverid: XXX,date: XXX, billno: XXX, amount: XXX, merchantUrl:XXX, paypath: XXX

你可能感兴趣的:(java)