我有這樣的字符串:分裂由java的正則表達式
Snt:It was the most widespread day of environmental action in the planet's history
====================
-----------
Snt:Five years ago, I was working for just over minimum wage
====================
-----------
,我想串與
====================
-----------
分裂和ofcourse從第一個句子中刪除Snt:
。 什麼是最好的方法?
我用這個正則表達式,但它沒有工作!
String[] content1 =content.split("\\n\\====================\\n\\-----------\\n");
在此先感謝。
使用'content.replaceAll( 「SNT」, 「」);'然後做分割 – Tirath 2014-10-03 16:56:47
這可能不是split'的'物盡其用。你是從文件中讀取這些行嗎?也許檢查你從'BufferedReader'返回的行真的是你想要做的。 – 2014-10-03 17:02:46