관심거리/Android
String 표기 팁..
ㅈㅍㅈㅈㅈ
2014. 9. 12. 16:14
요건 몰랐던 건데..신기해서 일단 킵
@strings.xml
<resources>
<string name="test">start %3$s, %2$s, %1$s end</string>
</resources>
@code
String text = getResources().getString(R.string.test);
String newText = String.format(text, "333", "222", "111");
@result
newText = start 111,222,333 end
%순서$s : 순서에 해당하는 값으로 출력