My Android advanced tour ------ & gt; single quotation mark error: Apostrophe not preceded by solution in Android string resources, apostrophe

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.