All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.neko233.config233.reader.convert.impl.DoubleConvertTextValueStrategy.kt Maven / Gradle / Ivy

The newest version!
package com.neko233.config233.reader.convert.impl

import com.neko233.config233.reader.convert.JavaTypeConvertTextValueStrategy
import java.math.BigDecimal

class DoubleConvertTextValueStrategy : JavaTypeConvertTextValueStrategy {
    override fun dataType(): Class = Double::class.java

    override fun convert(colValue: String): Double? {
        return try {
            BigDecimal(colValue).toDouble()
        } catch (e: NumberFormatException) {
            null
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy