<分区>
我在 strings.xml
中使用带占位符的字符串
<string name="date">%1$d.%2$d.%3$d</string>
并在代码中设置如下:
String.format(context.getResources().getString(R.string.date), day, month, year);
如果我们以5月5日为例,现在的结果是:
5.5.2015
如何将小于 10 的数字的前导零添加到字符串资源中?
不是 Left padding a String with Zeros 的副本因为这个问题的解决方案是:
String.format("%010d", Integer.parseInt(mystring));
但是android资源字符串的格式是:
%1$d
其中 1
表示索引。我应该把 02
放在哪里?