mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-02 14:46:31 +00:00
c28f7cb29f
Initial part of #435
18 lines
272 B
Go
18 lines
272 B
Go
package asciicheck
|
|
|
|
import "unicode"
|
|
|
|
func isASCII(s string) (rune, bool) {
|
|
if len(s) == 1 {
|
|
return []rune(s)[0], s[0] <= unicode.MaxASCII
|
|
}
|
|
|
|
r := []rune(s)
|
|
for i := 0; i < len(s); i++ {
|
|
if r[i] > unicode.MaxASCII {
|
|
return r[i], false
|
|
}
|
|
}
|
|
|
|
return 0, true
|
|
}
|