Issue
When I call something from the string.xml I get less, remove, the first space. Why?
<string name="s_basket_hun"> kosara</string>
<string name="s_basket_en">s basket</string>//removed the apostrophe
val cellValue = CustomerName + resources.getString(R.string.s_basket_hun)
I get just "kosara" instead " kosara"
There may be some wildcards like & nbsp; in html
Solution
It's normal check the reference https://developer.android.com/guide/topics/resources/string-resource#escaping_quotes
Whitespace collapsing and Android escaping happens after your resource file gets parsed as XML. This means that (space, punctuation space, Unicode Em space) all collapse to a single space (" "), because they are all Unicode spaces after the file is parsed as an XML. To preserve those spaces as they are, you can either quote them (" ") or use Android escaping ( \u0032 \u8200 \u8195).
So you have three alternatives
1- Use "
<string name="s_basket_hun">" kosara"</string>
2- Use HTML Code " (that is the same of ")
<string name="s_basket_hun">" kosara"</string>
3- Add space via code
val yourString = resources.getString(R.string.s_basket_hun)
val cellValue = "$CustomerName $yourString"
Answered By - appersiano
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.