我试图在Kotlin中填充一个字符串,以便在控制台输出上实现一些正确的对齐.大致如下:
accountsLoopQuery - "$.contactPoints.contactPoints[?(@.contactAccount.id)]"
brokerPassword - *****
brokerURI - tcp://localhost:61616
brokerUsername - admin
contactPointPriorityProperties - "contactPointPriority.properties"
customerCollection - "customer"
customerHistoryCollection - "customer_history"
defaultSystemOwner - "TUIGROUP"
I have ended up coding it this way - cheating with Java's String.format:
mutableList.forEach { cp ->
println(String.format("%-45s - %s", cp.name, cp.value))
}
Is there a proper way to do this with the Kotlin libraries?