(text string)
| 33 | } |
| 34 | |
| 35 | func CleanupOneLine(text string) string { |
| 36 | // remove all unicode control characters *including* |
| 37 | // '\n', '\r' and '\t' |
| 38 | t := runes.Remove(runes.Predicate(unicode.IsControl)) |
| 39 | sanitized, _, err := transform.String(t, text) |
| 40 | if err != nil { |
| 41 | // transform.String should never return an error as our transformer doesn't returns one. |
| 42 | // Confirmed with fuzzing. |
| 43 | panic(err) |
| 44 | } |
| 45 | |
| 46 | // trim extra new line not displayed in the github UI but still present in the data |
| 47 | return strings.TrimSpace(sanitized) |
| 48 | } |
| 49 | |
| 50 | func CleanupOneLineArray(texts []string) []string { |
| 51 | for i := range texts { |
no test coverage detected