Answer the question
In order to leave comments, you need to log in
How to copy from one file to another?
For example, there is a condition:
Create a file f whose components are integers. Rewrite positive numbers of file f into file g.
How can this be implemented in Kotlin,e?
Answer the question
In order to leave comments, you need to log in
val fr = FileReader("f.txt")
val array=fr.readText()
.substringAfter(':')
.substringBefore('К')
.split(' ')
.toList()
.filter { !it.contains('0') && !it.contains('-') }
println(array)
fr.close()
val newFw = FileWriter("g4.txt")
var numbers = ""
numbers = array.toString()
.substringAfter('[')
.substringBefore("]")
.filter { !it.isWhitespace() && !it.equals(',') }
newFw.append(numbers)
newFw.close()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question