mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 01:21:38 +08:00
update book code
This commit is contained in:
13
eBook/exercises/chapter_6/strings_map.go
Executable file
13
eBook/exercises/chapter_6/strings_map.go
Executable file
@@ -0,0 +1,13 @@
|
||||
// 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
|
Reference in New Issue
Block a user