diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/RequestExecutor.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/RequestExecutor.kt index 2174d785..dd00b2da 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/RequestExecutor.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/RequestExecutor.kt @@ -4,14 +4,13 @@ import net.dankito.banking.fints.messages.MessageBuilder import net.dankito.banking.fints.messages.MessageBuilderResult import net.dankito.banking.fints.model.* import net.dankito.banking.fints.response.BankResponse -import net.dankito.banking.fints.response.ResponseParser import net.dankito.banking.fints.response.segments.TanResponse import net.dankito.banking.fints.util.IBase64Service import net.dankito.banking.fints.util.PureKotlinBase64Service import net.dankito.banking.fints.webclient.IWebClient import net.dankito.banking.fints.webclient.KtorWebClient import net.dankito.banking.fints.webclient.WebClientResponse -import net.dankito.utils.multiplatform.getAllExceptionMessagesJoined +import net.dankito.utils.multiplatform.extensions.getAllExceptionMessagesJoined import net.dankito.utils.multiplatform.log.LoggerFactory diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/log/MessageLogCollector.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/log/MessageLogCollector.kt index 474e5c7f..f25b66cc 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/log/MessageLogCollector.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/log/MessageLogCollector.kt @@ -5,10 +5,9 @@ import net.dankito.banking.fints.model.MessageLogEntry import net.dankito.banking.fints.model.MessageLogEntryType import net.dankito.utils.multiplatform.log.Logger import net.dankito.utils.multiplatform.log.LoggerFactory -import net.dankito.utils.multiplatform.Date import net.dankito.utils.multiplatform.StackTraceHelper -import net.dankito.utils.multiplatform.StringHelper -import net.dankito.utils.multiplatform.getInnerException +import net.dankito.utils.multiplatform.extensions.format +import net.dankito.utils.multiplatform.extensions.getInnerException import kotlin.reflect.KClass @@ -81,7 +80,7 @@ open class MessageLogCollector { } protected open fun twoDigits(number: Int): String { - return StringHelper.format("%02d", number) + return number.format("%02d") } protected open fun getMessageTypeString(type: MessageLogEntryType): String { diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt index 25a79432..a7648db6 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt @@ -21,7 +21,7 @@ import net.dankito.banking.fints.model.Money import net.dankito.banking.fints.response.segments.* import net.dankito.banking.fints.util.MessageUtils import net.dankito.utils.multiplatform.Date -import net.dankito.utils.multiplatform.getAllExceptionMessagesJoined +import net.dankito.utils.multiplatform.extensions.getAllExceptionMessagesJoined import net.dankito.utils.multiplatform.log.LoggerFactory diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt index 6d1582c6..3023c613 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt @@ -6,7 +6,7 @@ import net.dankito.banking.fints.transactions.mt940.model.* import net.dankito.utils.multiplatform.Date import net.dankito.utils.multiplatform.DateFormatter import net.dankito.utils.multiplatform.Month -import net.dankito.utils.multiplatform.isUpperCase +import net.dankito.utils.multiplatform.extensions.isUpperCase import net.dankito.utils.multiplatform.log.LoggerFactory diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Date.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Date.kt index 864da226..a045ab88 100644 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Date.kt +++ b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Date.kt @@ -1,6 +1,16 @@ package net.dankito.utils.multiplatform + +fun Date.isBefore(other: Date): Boolean { + return compareTo(other) < 0 +} + +fun Date.isBeforeOrEquals(other: Date): Boolean { + return compareTo(other) <= 0 +} + + fun Date.format(format: DateFormatter): String { return format.format(this) } diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/CharExtensions.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/CharExtensions.kt new file mode 100644 index 00000000..7b81738b --- /dev/null +++ b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/CharExtensions.kt @@ -0,0 +1,13 @@ +package net.dankito.utils.multiplatform.extensions + + +val Char.isLowerCase: Boolean + get() = lowercaseChar() == this + +val Char.isUpperCase: Boolean + get() = isLowerCase == false + + +fun CharArray.asString(): String { + return this.joinToString("") +} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/NumberExtensions.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/NumberExtensions.kt new file mode 100644 index 00000000..71c8109a --- /dev/null +++ b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/NumberExtensions.kt @@ -0,0 +1,8 @@ +package net.dankito.utils.multiplatform.extensions + +import net.dankito.utils.multiplatform.StringHelper + + +fun Int.format(format: String): String { + return StringHelper.format(format, this) +} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/StringExtensions.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/StringExtensions.kt new file mode 100644 index 00000000..a1591931 --- /dev/null +++ b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/StringExtensions.kt @@ -0,0 +1,8 @@ +package net.dankito.utils.multiplatform.extensions + +import net.dankito.utils.multiplatform.StringHelper + + +fun String.format(vararg args: Any?): String { + return StringHelper.format(this, args) +} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/CommonExtensions.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/ThrowableExtensions.kt similarity index 72% rename from multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/CommonExtensions.kt rename to multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/ThrowableExtensions.kt index 5b463317..909723b1 100644 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/CommonExtensions.kt +++ b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/extensions/ThrowableExtensions.kt @@ -1,25 +1,4 @@ -package net.dankito.utils.multiplatform - - -val Char.isLowerCase: Boolean - get() = lowercaseChar() == this - -val Char.isUpperCase: Boolean - get() = isLowerCase == false - - -fun CharArray.asString(): String { - return this.joinToString("") -} - - -fun Date.isBefore(other: Date): Boolean { - return compareTo(other) < 0 -} - -fun Date.isBeforeOrEquals(other: Date): Boolean { - return compareTo(other) <= 0 -} +package net.dankito.utils.multiplatform.extensions fun Throwable.getAllExceptionMessagesJoined(maxDepth: Int = 5): String {