Empty tell if the string is considered empty once space and not graphics characters are removed
(s string)
| 9 | // Empty tell if the string is considered empty once space |
| 10 | // and not graphics characters are removed |
| 11 | func Empty(s string) bool { |
| 12 | trim := strings.TrimFunc(s, func(r rune) bool { |
| 13 | return unicode.IsSpace(r) || !unicode.IsGraphic(r) |
| 14 | }) |
| 15 | |
| 16 | return trim == "" |
| 17 | } |
| 18 | |
| 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 |
no outgoing calls
no test coverage detected