Книга: Beginning Android

String Formats

String Formats

As with other implementations of the Java language, Android’s Dalvik VM supports string formats. Here, the string contains placeholders representing data to be replaced at runtime by variable information (e.g., My name is %1$s). Plain strings stored as resources can be used as string formats:

String strFormat = getString(R.string.my_name);
String strResult = String.format(strFormat, "Tim");
((TextView)findViewById(R.layout.some_label)).setText(strResult);

Оглавление книги

Оглавление статьи/книги

Генерация: 1.044. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз