added remove control characters func
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m37s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m37s
This commit is contained in:
@@ -3,6 +3,7 @@ package langext
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
func StrLimit(val string, maxlen int, suffix string) string {
|
||||
@@ -136,3 +137,12 @@ func StrWrap(val string, linelen int, seperator string) string {
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func StrRemoveControlCharacters(str string) string {
|
||||
return strings.Map(func(r rune) rune {
|
||||
if unicode.IsControl(r) {
|
||||
return -1
|
||||
}
|
||||
return r
|
||||
}, str)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user