package dev.hodol.sandbox.base
fun main(args: Array<String>) {
val list = listOf(*args)
println("$list")
}
package dev.hodol.sandbox.base
fun main(args: Array<String>) {
val (k, v) = Pair("one", 1)
println("$k: $v")
val map = mapOf("one" to 1, "two" to 2)
for ((key: String, value: Int) in map) {
println("$key: $value")
}
for ((index, value) in listOf(1, 2, 3).withIndex()) {
println("$index: $value")
}
}
package dev.hodol.sandbox.base
fun printParsedPath(value: String) {
val regex = """(.+)/(.+)\.(.+)""".toRegex()
val result = regex.matchEntire(value)
if (result != null) {
val (directory, filename, extension) = result.destructured
println("dir: $directory, filename: $filename, extension: $extension")
}
}
fun main() {
printParsedPath("/Users/hodol/IdeaProjects/sandbox/docs.adoc")
}