File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -171,18 +171,23 @@ internal object Parsers : GlobalParserOptions {
171
171
return null
172
172
}
173
173
174
- private fun String.parseDouble (format : NumberFormat ) =
174
+ private val posixNumberFormat = NumberFormat .getInstance(Locale .forLanguageTag(" C.UTF-8" ))
175
+
176
+ private fun String.parseDouble (userNumberFormat : NumberFormat ) =
175
177
when (uppercase(Locale .getDefault())) {
176
178
" NAN" -> Double .NaN
177
179
" INF" -> Double .POSITIVE_INFINITY
178
180
" -INF" -> Double .NEGATIVE_INFINITY
179
181
" INFINITY" -> Double .POSITIVE_INFINITY
180
182
" -INFINITY" -> Double .NEGATIVE_INFINITY
181
183
else -> {
182
- val parsePosition = ParsePosition (0 )
183
- val result: Double? = format.parse(this , parsePosition)?.toDouble()
184
- if (parsePosition.index != this .length) null
185
- else result
184
+ fun parseWithFormat (format : NumberFormat ): Double? {
185
+ val parsePosition = ParsePosition (0 )
186
+ val result: Double? = format.parse(this , parsePosition)?.toDouble()
187
+ return if (parsePosition.index != this .length) null
188
+ else result
189
+ }
190
+ parseWithFormat(userNumberFormat) ? : parseWithFormat(posixNumberFormat)
186
191
}
187
192
}
188
193
You can’t perform that action at this time.
0 commit comments