MessageFormat.format()用法
String url=String.format(SapConstant.PARTNER_INIT +"?Company={0}&CardType={1}",company,cardType); String msg = "{0}{1}{2}{3}{4}{5}{6}{7}{8}"; Object [] array = new Object[]{"A","B","C","D","E","F","G","H","I",}; String value = MessageFormat.format(msg, array); System.out.println(value); // 输出:ABCDEFGHI String value = MessageFormat.format("oh, {0} is 'a' pig", "ZhangSan"); System.out.println(value); // 输出:oh, ZhangSan is a pig