Jump to content

Pangram checker: Difference between revisions

m (→‎{{header|Java}}: Removed unnecessary concatenation and toLowerCase() operation, added early exit if character is missing.)
Line 281:
assert(isPangram("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ")); // true
assert(!isPangram("")); // false
}</lang>
 
shorter but slower version
<lang d>import std.algorithm, std.string;
 
string alphabet = "abcdefghijklmnopqrstuvwxyz";
bool isPangram(string s) {
return equal(setIntersection(s.tolower, alphabet), alphabet);
}</lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.