我有以下字符串:工具字符串轉換爲XML安全的字符串
Here's the thing. You said a "mountain lion is a lion." Is it in the same family? Yes. No one's arguing that. As someone who is a scientist who studies lions, I am telling you, specifically, in science, no one calls mountain lions "lions". If you want to be "specific" like you said, then you shouldn't either. They're not the same thing. If you're saying lion family" you're referring to the taxonomic grouping of Felidae, which includes things from house cats to ocelots to tigers. So your reasoning for calling a mountain lion a lion is because random people "call the big ones lions?" Let's get panthers and leopards in there, then, too. Also, calling someone a human or an ape? It's not one or the other, that's not how taxonomy works. They're both. A mountain lion is a mountain lion and a member of the lion family. But that's not what you said. You said a mountain lion is a lion, which is not true unless you're okay with calling all members of the lion family lions, which means you'd call house cats, tigers, and other cats lions, too. Which you said you don't. It's okay to just admit you're wrong, you know?
,我想轉換成一個正確格式化字符串把我的strings.xml文件。
我使用以下工具嘗試:
http://coderstoolbox.net/string/#!encoding=xml&action=encode&charset=none http://www.freeformatter.com/xml-escape.html#ad-output
但每次我建項目中,我得到了以下錯誤時間:
Error:(39, 5) Apostrophe not preceded by \ (in Here's the thing. You said a "mountain lion is a lion."
我能做些什麼?
另外奇怪的是,字符串中的所有撇號已被替換爲 '
所以我不知道爲什麼我仍然得到該錯誤。當我手動將\
放在每個'
前面時都很好,但這非常不方便。我想自動化這個過程。
問題是我想自動化這個過程 – Roymunson
@Roymunson:字符串替換已經存在,因爲COBOL,如果我沒記錯的話。 uage,高於彙編程序,並不提供Java的replaceAll(「'」,「」')「等等。 – CommonsWare
我正在尋找一個可以爲我做的在線工具。但由於編程非常簡單,所以我會自己做出快速解決方案。 – Roymunson