Skip to content

Instantly share code, notes, and snippets.

@LiewJunTung
Created April 1, 2019 06:35
Show Gist options
  • Save LiewJunTung/8b84ef83a7e3ce991b059b599d9608c4 to your computer and use it in GitHub Desktop.
Save LiewJunTung/8b84ef83a7e3ce991b059b599d9608c4 to your computer and use it in GitHub Desktop.
task replaceTest {
doLast {
replaceText("$projectDir/tools/app_history_a", "history.txt", "OK Google", "OK Dara")
}
}
void replaceText(String folderPath, String match, String oldText, String newText) {
fileTree(folderPath).matching {
include match
}.each {
println it.text
def replaced = it.text.replace(oldText, newText)
it.setText(replaced)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment