okardec

Untitled

Sep 14th, 2020
641
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     fun getField(fieldName: String, toType : String = ""): Any? {
  2.         ///return fields.get(fieldName).toString()
  3.  
  4.         val value = fields.get(fieldName).toString()
  5.  
  6.         return when(toType?.toLowerCase()){
  7.             "string" -> value
  8.             "int" -> value.toIntOrNull()
  9.             "double" -> value.toDoubleOrNull()
  10.             "dec" -> value.toBigDecimal()
  11.             else -> value
  12.         }
  13.  
  14.     }
RAW Paste Data