Escaping single quotes in resource xml for Android

前端 未结 3 1978
無奈伤痛
無奈伤痛 2021-01-04 03:52

I have a file with strings in my ../res/values/strings.xml, which I try to source for my project. This works fine with normal texts. Problem : I have single quotes in my tex

相关标签:
3条回答
  • 2021-01-04 04:54

    You can use \' in your string resources.

    0 讨论(0)
  • 2021-01-04 04:57

    you need to escape the apostrophe by using

    \ before '
    

    etc didn't should be like

    didn\'t
    
    0 讨论(0)
  • 2021-01-04 04:58

    Use double quotes:

    <string name="mystring_id">"'Hello'"</string>
    
    0 讨论(0)
提交回复
热议问题