我尝试在文本文件中查找特定字符串。 该文件看起来像这样:在文本文件中查找字符串
2,1,'Ausbau der techn。原基”
2,2, '拓德装置技术'
2,3, 'Estensione阿尔istallazioni tecniche'
我试图找到之间的文本'的迹象。
//Will be set automaticly after implementation.
int project = 2
int languageInteger = 1
String findings = new File(usedPath)?.eachLine {
it.substring((project+ ", " + languageInteger + ", "))
}
这是行不通的。我也试过用FindAll Closure或find。但我犯了一些错误。
我应该怎么做才能找到文本?
这篇文章解释[如何获得引号之间的字符串数据(http://stackoverflow.com/questions/1473155/how-to-get-data-between-quotes-in-java)。你必须用正则表达式替换正则表达式中的'''' – Kaadzia
不,我知道“ist not' 我在下面的解决方案中做了一个replaceAll(”'“,”“),它工作正常现在。 – CollinG
我的意思是如果你打算使用教程中的正则表达式:'Pattern.compile(“\”([^ \“] *)\”“);''你必须替换'''' - ) – Kaadzia