My Android advanced tour ------> single quotation mark error: Apostrophe not preceded by solution in Android string resources, apostrophe
I wrote a single quotation mark in the string resource file and reported an error. The error code is as follows:
error: Apostrophe not preceded by \ (in OuyangPeng's blog )
The resource file is as follows:
<?xml version="1.0" encoding="utf-8"?><resources> <string name="ouyang">OuyangPeng's blog </string> <string name="blog"> http://blog.csdn.net/ouyang_peng</string></resources>
There are two solutions:
Method 1: Use double quotation marks to enclose string resources in single quotes, as shown below:
<string name="ouyang">"OuyangPeng's blog" </string>
Method 2: Add \ for escape before '.
To avoid ambiguity:
<string name="ouyang">OuyangPeng\'s blog </string>
Refer to the previous article: My Android advanced tour ------> error: Apostrophe not preceded by \ error Solution
(Address: http://blog.csdn.net/ouyang_peng/article/details/16939225)
========================================================== ========================================================== ============================
Author: Ouyang Peng: Welcome to repost. sharing with others is the source of progress!
Reprinted Please retain the original address: http://blog.csdn.net/ouyang_peng
========================================================== ========================================================== ============================
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.