forEachLine
val filesDir = _files.getFilesDir()
val file = _files.buildFile {
setPath(filesDir, "tmp/aaa.txt")
}
file.writeText("hello world", "UTF-8")
file.forEachLine("UTF-8") {
_console.log(it)
}
file.delete()
def filesDir = $files.getFilesDir()
def file = $files.buildFile {
setPath(filesDir, "tmp/aaa.txt")
}
file.writeText("hello world", "UTF-8")
file.forEachLine("UTF-8") {
$console.log(it)
}
file.delete()
let filesDir = $files.getFilesDir()
let file = $files.buildFile((fileBuilder) => {
fileBuilder.setPath(filesDir, "tmp/aaa.txt")
})
file.writeText("hello world", "UTF-8")
file.forEachLine("UTF-8", (line) => {
$console.log(line)
})
file.delete()
local filesDir = _files:getFilesDir()
local file = _files:buildFile(function(fileBuilder)
fileBuilder:setPath(filesDir, "tmp/aaa.txt")
end)
file:writeText("hello world", "UTF-8")
file:forEachLine("UTF-8", function(it)
_console:log(it)
end)
file:delete()
<?php
$filesDir = $files->getFilesDir();
$file = $files->buildFile(function ($fileBuilder) use ($filesDir) {
$fileBuilder->setPath($filesDir, "tmp/aaa.txt");
});
$file->writeText("hello world", "UTF-8");
$file->forEachLine("UTF-8", function ($it) use ($console) {
$console->log($it);
});
$file->delete();
filesDir = _files.getFilesDir()
def fn1(fileBuilder):
fileBuilder.setPath(filesDir, "tmp/aaa.txt")
file = _files.buildFile(fn1)
file.writeText("hello world", "UTF-8")
def fn2(it):
_console.log(it)
file.forEachLine("UTF-8", fn2)
file.delete()
filesDir = $files.getFilesDir()
file = $files.buildFile { |fileBuilder|
fileBuilder.setPath(filesDir, "tmp/aaa.txt")
}
file.writeText("hello world", "UTF-8")
file.forEachLine("UTF-8") { |it|
$console.log(it)
}
file.delete()
Last modified: 29 May 2025