内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
我在string s.xml文件中编写了以下内容:
<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>
得到了以下错误:
The reference to entity "Drop" must end with the ';' delimiter.
我如何写字符&在string s.xml中?
public String handleEscapeCharacter( String str ) {
String[] escapeCharacters = { ">", "<", "&", """, "'" };
String[] onReadableCharacter = {">", "<", "&", "\"\"", "'"};
for (int i = 0; i < escapeCharacters.length; i++) {
str = str.replace(escapeCharacters[i], onReadableCharacter[i]);
} return str;
}
可以在它们的数组中添加字符和符号