dave08
11/06/2018, 4:15 PMval someSet: Set<String>? = setOf("this", "that", "this=3")
and I'd like to extract the 3 as an Int
, is this the most ideomatic/efficient way to do it?
someSet?.firstOrNull { it.startsWith("this=") }
?.substringAfter("this=")
?.toInt() ?: 0
dalexander
11/06/2018, 4:28 PMdave08
11/06/2018, 4:35 PMdigitalsanctum
11/06/2018, 4:39 PM?.toIntOrNull() ?: 0
for the last bitdave08
11/06/2018, 4:40 PM