I'm looking at the string.Map
function which must take a mapping function which returns a rune. I would like to eliminate runes that resolves false with a call to: unicode.IsPrint()
func Map(mapping func(rune) rune, s string) string
My function looks something like this:
func main() {
func CleanUp(s string) string {
clean := func(r rune) rune {
if unicode.IsPrint(r) || r == rune('\n') {
return r
}
return rune('')
}
strings.Map(clean, s)
}
It should clean something like this "helloworld ' \x10"
to "helloworld ' "
But rune('')
is invalid. How can I return a blank or empty rune?
missing argument to conversion to rune: rune()
– Lyon