コンソール出力で適切な位置合わせを行うために、Kotlinで文字列を埋めようとしていました。これらの線に沿って何か:Kotlinのパディング文字列
accountsLoopQuery - "$.contactPoints.contactPoints[?(@.contactAccount.id)]"
brokerPassword - *****
brokerURI - tcp://localhost:61616
brokerUsername - admin
contactPointPriorityProperties - "contactPointPriority.properties"
customerCollection - "customer"
customerHistoryCollection - "customer_history"
defaultSystemOwner - "TUIGROUP"
私はそれをこのようにコーディング終わっている - JavaのString.Formatのに浮気:
mutableList.forEach { cp ->
println(String.format("%-45s - %s", cp.name, cp.value))
}
はKotlinライブラリでこれを行うための適切な方法はありますか?あなたが代わりにString#format拡張機能を使用してすることができます
良い答え。私はあなたが提案したことを試してみました。それは魅力のように機能します。 –