如何退回空白符文

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('
') {
            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?

If you want to eliminate runes, a "blank rune" is not the way to go. That would not eliminate anything.

Assuming you're talking about strings.Map, the docs say

If mapping returns a negative value, the character is dropped from the string with no replacement.

Have your mapper return a negative value to indicate that a rune should be discarded.

From what I understand, a rune is actually an integer value mapped to a unicode character, so this piece of code actually returns the \0 character if the condition check fails:

package main

import (
    "fmt"
    "strings"
    "unicode"
)

func main() {
    fmt.Println(CleanUp("helloworld ' \x10"))
}

func CleanUp(s string) string {

    clean := func(r rune) rune {
        if unicode.IsPrint(r) || r == rune('
') {
            return r
        }
        return rune(0)
    }

    return strings.Map(clean, s)
}

Outputs

helloworld '