Lilly
09/15/2021, 9:30 PMmyString
.map { it.split(";") }
gives me a List<List<String>>
where the last items are empty strings because split
interperets ";" as empty string -> ""
. I would like to have null
instead of ""
. How can I achieve this? Output should be List<List<String?>>
ade
09/15/2021, 9:33 PMLilly
09/15/2021, 9:34 PMit
is a List<String>, that does not workLilly
09/15/2021, 9:37 PM.map { it.split(";") }
.flatten()
.map { it.ifBlank { null } }
but then I don't know how to get it back to List<List<String?>>
ade
09/15/2021, 9:41 PMLilly
09/15/2021, 9:46 PM.map { it.split(";").map { item -> item.ifBlank { null } } }