我有一個字符串像從字符串中刪除單引號,但不是從開始和結束
String abc = "'Joe's Dinner'";
現在我需要從中間刪除該帖,這樣的結果可以像
abc = "'Joes Dinner'"
編輯: 我意識到問題發生在別的地方。實際上我分裂了一個5 GB的XML文件。我正在使用StAX來做到這一點。這是我的代碼。
public String split(String fileName){
XMLInputFactory xif = XMLInputFactory.newInstance();
XMLEventReader xer = xif.createXMLEventReader(new FileInputStream(new File(fileName)));
String fileContent = "";
while(xer.hasNext()) {
XMLEvent e = xer.nextEvent();
fileContent = fileContent + e.toString();
}
return fileContent;
}
現在,在我的源XML行當屬
<location state="Côte d'Azur" xsi:nil="true" city="Marseille" country="FRANCE"></location>
但在輸出屬性值雙引號更改爲單引號在分析導致的錯誤。有沒有什麼辦法保留這個雙引號。
你試過在SO上搜索嗎?你能告訴我們一些代碼嗎? – TheLostMind
只是'''喬的晚餐'''或者更像'「......文本文本'喬的晚餐'文本文本...」「? – gdros
我實際上正在嘗試正則表達式,而我發現的其實也是選擇起始單引號。沒有運氣。 –