mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 22:06:51 +08:00
20 lines
242 B
Go
Executable File
20 lines
242 B
Go
Executable File
// strings_map.go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
asciiOnly := func(c rune) rune {
|
|
if c > 127 {
|
|
return ' '
|
|
}
|
|
return c
|
|
}
|
|
fmt.Println(strings.Map(asciiOnly, "Jérôme Österreich"))
|
|
}
|
|
|
|
// J r me sterreich
|