问题描述:

Users of my app will be able to re-format the information they see - they will need to edit string like:

<b>Movie name:</b> %1$s, <br><b>Country: </b> %2$s.

Then I take this string and apply String.format.

For ex., Country is empty, in result user will see:

Movie name: SomeMovieName, Country:

Is there any way to not show the whole Country line if %2$s is empty?

网友答案:

Yes <br><b>Country: </b> needs to be included in the replacement string "Country" rather than in the final formated string.

相关阅读:
Top