Pangram checker: Difference between revisions

Content added Content deleted
(Added Rust implementation of Pangram checker)
(→‎{{header|Go}}: Use bit fiddling, since it makes the code shorter and uses less memory)
Line 1,123: Line 1,123:


func pangram(s string) bool {
func pangram(s string) bool {
var rep [26]bool
var missing uint32 = (1 << 26) - 1
var count int
for _, c := range s {
var index uint32
for _, c := range s {
if c >= 'a' {
if 'a' <= c && c <= 'z' {
if c > 'z' {
index = uint32(c - 'a')
continue
} else if 'A' <= c && c <= 'Z' {
index = uint32(c - 'A')
}
} else {
c -= 'a'
continue
} else {
}
if c < 'A' || c > 'Z' {

continue
missing &^= 1 << index
}
if missing == 0 {
c -= 'A'
return true
}
}
if !rep[c] {
}
if count == 25 {
return true
return false
}
rep[c] = true
count++
}
}
return false
}</lang>
}</lang>
{{out}}
{{out}}