Skip to content

Commit e4a9bd6

Browse files
committed
new helpers file
1 parent b37bf02 commit e4a9bd6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

helpers.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"unicode"
5+
)
6+
7+
func contains(slice []int, value int) bool {
8+
for _, v := range slice {
9+
if v == value {
10+
return true
11+
}
12+
}
13+
return false
14+
}
15+
16+
func removeNonPrintableAscii(input string) string {
17+
var resultBuilder []rune
18+
19+
for _, char := range input {
20+
if unicode.IsPrint(char) && char >= 32 && char != 127 {
21+
resultBuilder = append(resultBuilder, char)
22+
}
23+
}
24+
25+
return string(resultBuilder)
26+
}

0 commit comments

Comments
 (0)