From fd1343d8b9f5ebdb9623c1d9cf79a311c46f0c94 Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 19 May 2020 12:37:59 +0200 Subject: [PATCH] Could half the mapping time by checking first if the string contains the masking character before calling replace() (why does this make any difference?) --- .../net/dankito/banking/fints/response/ResponseParser.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fints4k/src/main/kotlin/net/dankito/banking/fints/response/ResponseParser.kt b/fints4k/src/main/kotlin/net/dankito/banking/fints/response/ResponseParser.kt index 225dd289..2c9ac581 100644 --- a/fints4k/src/main/kotlin/net/dankito/banking/fints/response/ResponseParser.kt +++ b/fints4k/src/main/kotlin/net/dankito/banking/fints/response/ResponseParser.kt @@ -742,7 +742,10 @@ open class ResponseParser @JvmOverloads constructor( elements.add(dataString.substring(startIndex)) } - return elements.map { it.replace(Separators.MaskingCharacter + separator, separator) } + return elements.map { + if (it.contains(Separators.MaskingCharacter + separator)) it.replace(Separators.MaskingCharacter + separator, separator.toString()) + else it + } }