<@U4L9S0L0J> commented on <@U7VTJDE4R>’s file <htt...
# announcements
u
@beholder commented on @Intrux’s file

https://kotlinlang.slack.com/files/U7VTJDE4R/F7WDEPK1Q/screen_shot_2017-11-07_at_1.40.08_pm.png

:
Copy code
fun readFromFile(path: String, newLine: Boolean): String {
    val text = StringBuilder()
    val separator = System.getProperty("line.separator")
    return FileReader(path).use { fileReader ->
        BufferedReader(fileReader).forEachLine {
            text.append(it)
            if (newLine) text.append(separator)
        }
        text.toString()
    }
}