How can I write character & in android strings.xml


Question

I wrote the following in the strings.xml file:

<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>

I got the following error:

The reference to entity "Drop" must end with the ';' delimiter.

How can I write character & in the strings.xml?

1
388
3/8/2018 7:48:52 AM

Accepted Answer

Encode it:

&amp;
961
6/16/2010 12:11:43 PM

For special character I normally use the Unicode definition, for the '&' for example: \u0026 if I am correct. Here is a nice reference page: http://jrgraphix.net/research/unicode_blocks.php?block=0


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon