aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/mcprepack/CSVFile.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/mcprepack/CSVFile.kt')
-rw-r--r--src/main/kotlin/mcprepack/CSVFile.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/kotlin/mcprepack/CSVFile.kt b/src/main/kotlin/mcprepack/CSVFile.kt
index 1ddc03f..b2bcfaa 100644
--- a/src/main/kotlin/mcprepack/CSVFile.kt
+++ b/src/main/kotlin/mcprepack/CSVFile.kt
@@ -3,4 +3,12 @@ package mcprepack
data class CSVFile(val headers: List<String>, val entries: List<List<String>>) {
val map = entries.map { headers.zip(it).toMap() }
val indexedBySearge = map.associateBy { it["searge"] }
+ val indexedByParamName = map.groupBy {
+ val match = it["param"]?.let { paramRegex.matchEntire(it) } ?: return@groupBy null
+ match.groupValues[1].toInt()
+ }
+
+ companion object {
+ val paramRegex = "p_([0-9]+)_([0-9]+)_.*".toRegex()
+ }
}