Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Fix Issue 520 #2517

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.ivy.wallet.io.persistence.dao.TransactionDao
import com.ivy.wallet.utils.format
import com.ivy.wallet.utils.formatLocal
import com.ivy.wallet.utils.ioThread
import com.ivy.wallet.utils.localDecimalSeparator
import com.ivy.wallet.utils.writeToFile
import org.apache.commons.text.StringEscapeUtils
import java.util.*
Expand Down Expand Up @@ -220,9 +221,24 @@ class ExportCSVLogic(
}

private fun Double.formatAmountCSV(currency: String): String {
return this.format(currency)
.replace(",", "")
.escapeCSVString()

val ivyAmountFormat = this.format(currency)

// string result example: 1078.38
return when(localDecimalSeparator()) {
"." -> {
// source string example: 1,078.38
ivyAmountFormat
.replace(",", "")
}
"," -> {
// source string example: 1.078,39
ivyAmountFormat
.replace(".", "")
.replace(",", ".")
}
else -> ivyAmountFormat
}.escapeCSVString()
}

private fun String.escapeCSVString(): String {
Expand Down