tim*_*tes 49
阅读以下文字:
String contents = new File( 'whatever.txt' ).getText( 'UTF-8' )
Run Code Online (Sandbox Code Playgroud)
替换文字
contents = contents.replaceAll( 'xxx', 'yyy' )
Run Code Online (Sandbox Code Playgroud)
再次写出文本
new File( 'replaced.txt' ).write( contents, 'UTF-8' )
Run Code Online (Sandbox Code Playgroud)
您应该能够将它们包装到任务中并正常调用该任务
我假设您正在谈论资源处理。在这种情况下,您可以使用自由格式filter方法:
processResources {
filter { String line -> line.replace(...) }
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25447 次 |
| 最近记录: |