Colton Idle
01/25/2024, 7:41 PMval curr = if (myNullableInt == null) "" else myNullableInt.toString()
Sam
01/25/2024, 7:47 PMmyNullableInt?.toString().orEmpty()
Colton Idle
01/25/2024, 8:12 PMmyNullableInt.toString().orEmpty()
cool. knew i was doing something dumbColton Idle
01/25/2024, 8:12 PMJoffrey
01/25/2024, 8:14 PM?: ""
clearer than extensions on nullable values like orEmpty
. So I would personally go for:
myNullableInt?.toString() ?: ""