sir-haver
sir-haver

Reputation: 3592

Is it safe to use apostrophe within my Android app name?

I did try and it's working:

Strings.xml:

<resources>
    <string name="app_name">Let\'s Use It</string>

It builds successfully too, but I was wondering whether it may cause problems in the future?

Upvotes: 3

Views: 1515

Answers (2)

jon.bray.eth
jon.bray.eth

Reputation: 617

As long as you are using the proper escape characters where the app_name string is stored, there is nothing wrong with having an apostrophe in your app name.

If you are worried about it not displaying correctly in places where it's references, you have done everything by the books, i.e. keeping your strings in the Strings.xml file and referencing app_name as needed.

Looks like you are good to go!

Upvotes: 1

Andrii Artamonov
Andrii Artamonov

Reputation: 648

There is nothing suspicious regarding using escaping character forms. It is only one way how to make symbols with special use work. From Android docs:

When a string contains characters that have special usage in XML or Android, you must escape the characters. Some characters can be escaped by using a preceding backslash, while others require XML escaping. Apostrophes and single quotes can also be handled by enclosing the entire string in double quotes.

There are three ways to handle single quotes displaying:

  • &apos ; (without space)
  • \'
  • Enclose the entire string in double quotes ("This'll work", for example)

Upvotes: 2

Related Questions