Safe will tell if a character in the string is considered unsafe Currently trigger on unicode control character except \n, \t and \r
(s string)
| 19 | // Safe will tell if a character in the string is considered unsafe |
| 20 | // Currently trigger on unicode control character except \n, \t and \r |
| 21 | func Safe(s string) bool { |
| 22 | for _, r := range s { |
| 23 | switch r { |
| 24 | case '\t', '\r', '\n': |
| 25 | continue |
| 26 | } |
| 27 | |
| 28 | if unicode.IsControl(r) { |
| 29 | return false |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | return true |
| 34 | } |
| 35 | |
| 36 | // SafeOneLine will tell if a character in the string is considered unsafe |
| 37 | // Currently trigger on all unicode control character |