add MarshalJSON and UnmarshalJSON to BitArray (#200)

See CHANGELOG
This commit is contained in:
Anton Kaliaev
2018-04-23 09:16:05 +02:00
committed by Jae Kwon
parent 8fa4211bbd
commit d94e312673
5 changed files with 155 additions and 12 deletions

View File

@ -57,3 +57,18 @@ func SplitAndTrim(s, sep, cutset string) []string {
}
return spl
}
// Returns true if s is a non-empty printable non-tab ascii character.
func IsASCIIText(s string) bool {
if len(s) == 0 {
return false
}
for _, b := range []byte(s) {
if 32 <= b && b <= 126 {
// good
} else {
return false
}
}
return true
}