Skip to content

Commit

Permalink
refactored: substring() -> take()
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuth committed Dec 16, 2024
1 parent 848bf3a commit 869a7b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/de/gmuth/ipp/iana/IppRegistrationsSection4.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object IppRegistrationsSection4 {

fun getKeywordAttributeValuesForAttribute(attribute: String) = allKeywordAttributeValues
.filter { it.attribute == attribute }
.apply { if(isEmpty()) throw IppException("Attribute not found: $attribute") }
.apply { if (isEmpty()) throw IppException("Attribute not found: $attribute") }

fun getKeywordValuesForAttribute(attribute: String) = getKeywordAttributeValuesForAttribute(attribute)
.filterNot { it.keywordValue.isBlank() || it.keywordValue.contains("Any") }
Expand All @@ -53,7 +53,7 @@ object IppRegistrationsSection4 {
logger.info { "keyword values for $name ($syntax), $collection, $reference}" }
}
getKeywordValuesForAttribute(attribute)
.groupBy { it.substring(0, 3) }
.forEach { logger.info { "- ${it.value.joinToString(", ")}" } }
.groupBy { it.take(3) }
.forEach { logger.info { it.value.joinToString(", ") } }
}
}

0 comments on commit 869a7b4

Please sign in to comment.