Stephan Schroeder
02/14/2020, 5:03 PMFun String.removeChars(allTheCharsToRemove: String): String
there is the String.replace(regex, replacement) that you could call with ""
as second parameter. So I’d have to create a Regex from my allTheCharsToRemove
(how? if that’d be your approach) or is there a better way?Fleshgrinder
02/14/2020, 5:08 PMString.strip
maybe? In any event, if you want to remove literals iterate and do not create a RegExp, way too much overhead.Robert
02/14/2020, 5:27 PMallTheCharsToRemove
fun String.removeAll(toRemove:String) = this.removeAll(toRemove.toCharArray())
fun String.removeAll(toRemove:CharArray) : String = filterNot(toRemove::contains)