这样就可以了:
strFoo = "u20B9" + strBar
但这不是
strFoo = R.string.rupee_symbol.toString() + strBar //.toString() is required
//R.string.rupee_symbol.toString() evaluates to some random number 2131755148... which I believe is a character array...
strings.xml
<string name="rupee_symbol">u20B9 </string>
我不明白为什么它会这样做,它看起来是一样的…!
您不应该将字符串与字符串资源连接,您可以使用占位符:
<string name="rupee_symbol">u20B9%s</string>
和使用:
strFoo = resources.getString(R.string.rupee_symbol, strBar)
用getString(R.string.rupee_symbol)
代替R.string.rupee_symbol.toString()
For example-
String strBar = String.valueOf(100);
String strFoo = getString(R.string.rupee_symbol)+strBar;
textView.setText( strFoo);