Could half the mapping time by checking first if the string contains the masking character before calling replace() (why does this make any difference?)

This commit is contained in:
dankito 2020-05-19 12:37:59 +02:00
parent face00e2a7
commit fd1343d8b9
1 changed files with 4 additions and 1 deletions

View File

@ -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
}
}