Pangram checker: Difference between revisions
Content added Content deleted
m (Added the Sidef language) |
(Adding a second example for Mathematica) |
||
Line 1,161: | Line 1,161: | ||
<pre>pangramQ["The quick brown fox jumps over the lazy dog."] |
<pre>pangramQ["The quick brown fox jumps over the lazy dog."] |
||
True</pre> |
True</pre> |
||
Or a slightly more verbose version that outputs the missing characters if the string is not a pangram: |
|||
<lang Mathematica>pangramQ[msg_] := |
|||
Function[If[# === {}, Print["The string is a pangram!"], |
|||
Print["The string is not a pangram. It's missing the letters " <> |
|||
ToString[#]]]][ |
|||
Complement[CharacterRange["a", "z"], Characters[ToLowerCase[msg]]]]</lang> |
|||
Usage: |
|||
<pre>pangramQ["The quick brown fox jumps over the lazy dog."] |
|||
The string is a pangram!</pre> |
|||
<pre>pangramQ["Not a pangram"] |
|||
The string is not a pangram. It's missing the letters {b, c, d, e, f, h, i, j, k, l, q, s, u, v, w, x, y, z}</pre> |
|||
=={{header|MATLAB}}== |
=={{header|MATLAB}}== |