nwh
06/05/2018, 1:14 PMdata class Example(val name: String?)
Let's say I have an Example("")
, but I want blank strings to be null. I can do:
ex.copy(name = if (name.isBlankOrNull()) null else name)
But this requires hard coding. Is there a safe way to process all the fields like this?Andreas Sinz
06/05/2018, 1:23 PM