We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1149c82 commit 47e06aeCopy full SHA for 47e06ae
src/main/kotlin/kscript/experimental/Incubator.kt
@@ -0,0 +1,20 @@
1
+package kscript.experimental
2
+
3
+import java.io.File
4
5
+/**
6
+ * Experimental support methods. Those may change without further notice.
7
+ *
8
+ * @author Holger Brandl
9
+ */
10
11
12
+fun <T> File.mapLines(trafo: (String) -> T) {
13
+ return useLines {
14
+ it.map { trafo(it) }
15
+ }
16
+}
17
18
+fun String.processLines(trafo: (String) -> String) {
19
+ split("\n").map { println(trafo(it)) }
20
0 commit comments