aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.kt
diff options
context:
space:
mode:
authortchojnacki <tomaszchojnacki2001@gmail.com>2021-12-04 13:24:49 +0100
committertchojnacki <tomaszchojnacki2001@gmail.com>2021-12-04 13:24:49 +0100
commitd38649aa2e9e79f8c5bbabef3e39de38342702e1 (patch)
treebe2354432747a68c4290d675f1f346143df9ac5d /src/Utils.kt
parentd5057fc4d578fba728a3ee70d9ba73e84a8a6772 (diff)
downloadgleam_aoc2020-d38649aa2e9e79f8c5bbabef3e39de38342702e1.tar.gz
gleam_aoc2020-d38649aa2e9e79f8c5bbabef3e39de38342702e1.zip
Complete day 4
Diffstat (limited to 'src/Utils.kt')
-rw-r--r--src/Utils.kt7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Utils.kt b/src/Utils.kt
index 27b88b5..6268ba6 100644
--- a/src/Utils.kt
+++ b/src/Utils.kt
@@ -10,6 +10,13 @@ import java.security.MessageDigest
fun readInputAsLines(name: String): List<String> = File("src", "$name.txt").readLines()
/**
+ * Returns a string of contents of the given input txt file.
+ * @param name name of the file
+ * @return contents of file as string
+ */
+fun readInputAsString(name: String): String = File("src", "$name.txt").readText()
+
+/**
* Read lines from the given input txt file and convert them to decimal numbers.
* @param name name of the file
* @return list of ints containing numbers from each of file's lines