LoginSignup
12
10

More than 5 years have passed since last update.

stringリソースファイル内で文字として%を使う

Last updated at Posted at 2012-06-26

以下だと実行しようとするとエラーになる。

<string name="complete">100% OK</string>

formatで使うからまあ当然だわな。
%%でエスケープかと思ったら違った。
formatted="false"を指定すればよろしいようです。

<string name="complete" formatted="false">100% OK</string>

追記。
formatを使用しつつ、%も文字として表示したい場合は、%%で良いようです。

<string name="complete">%1$d %% OK</string>
12
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
10