LeoColman
02/02/2023, 2:32 PMremoveThisCharacters
from an entire string?
"abc".replace("a", "")
vs an idealized "abc".remove("a")
There is removePrefix
, removeSuffix
and removeSurrounding
, but not a plain remove
😞Luke Armitage
02/02/2023, 2:39 PMreplace
to give you your idealised remove
function? 🙂LeoColman
02/02/2023, 2:44 PMKlitos Kyriacou
02/02/2023, 3:12 PMreplace("a", "")
seems to be the most concise, but also consider filter { it != 'a' }
to avoid having to turn the char 'a' into the string "a".ephemient
02/02/2023, 8:47 PMremove('a')
that are more efficient than filter { it != 'a' }
. in practice, JVM doesn't have them so it doesn't matter