Closed nkiesel closed 2 years ago
https://github.com/nkiesel/AdventOfCode2021/blob/dadc1e8e0acfc88382a52c363f1bfc3a4022a785/src/test/kotlin/Day02.kt#L39
(Just trying out how to comment on code in github....)
You could use s.split(" ") instead of s.split(" ".toRegex()) (Kotlin has overloaded split for String and Regex argument)
s.split(" ")
s.split(" ".toRegex())
split
String
Regex
updated using split(" ")
https://github.com/nkiesel/AdventOfCode2021/blob/dadc1e8e0acfc88382a52c363f1bfc3a4022a785/src/test/kotlin/Day02.kt#L39
(Just trying out how to comment on code in github....)
You could use
s.split(" ")
instead ofs.split(" ".toRegex())
(Kotlin has overloadedsplit
forString
andRegex
argument)