-
-
Save imax9000/759526fe17592555997c60b16c0579c0 to your computer and use it in GitHub Desktop.
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
| func escapeRune(c rune) rune { | |
| if uint(c) < 0x20 { | |
| return '_' | |
| } | |
| switch c { | |
| case ';', '\n', '"', '\\': | |
| return '_' | |
| default: | |
| return c | |
| } | |
| } | |
| func EscapeFileName(filename string) string { | |
| return strings.Map(escapeRune, filename) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment