Created
May 2, 2018 12:27
-
-
Save wjx0912/3ec002f7d7f53bbe20cd23794927b32f to your computer and use it in GitHub Desktop.
golang split string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://medium.com/@mlowicki/strings-fieldsfunc-vs-strings-split-96c667912f78 | |
| fmt.Printf("%#v\n", strings.Split("/a/b/c", "/")) | |
| // []string{"", "a", "b", "c"} | |
| fmt.Printf("%#v\n", strings.FieldsFunc("/a/b/c", func(c rune) bool { return c == ‘/’ })) | |
| // []string{"a", "b", "c"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment