Pangram checker: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Modula-2) |
(Added solution for Action!) |
||
Line 87: | Line 87: | ||
(contains-each (coerce "abcdefghijklmnopqrstuvwxyz" 'list) |
(contains-each (coerce "abcdefghijklmnopqrstuvwxyz" 'list) |
||
(coerce (string-downcase str) 'list)))</lang> |
(coerce (string-downcase str) 'list)))</lang> |
||
=={{header|Action!}}== |
|||
{{libheader|Action! Tool Kit}} |
|||
<lang Action!>INCLUDE "D2:CHARTEST.ACT" ;from the Action! Tool Kit |
|||
DEFINE CHAR_COUNT="26" |
|||
BYTE FUNC IsPangram(CHAR ARRAY t) |
|||
BYTE ARRAY tab(CHAR_COUNT) |
|||
BYTE i,c |
|||
FOR i=0 TO CHAR_COUNT-1 |
|||
DO tab(i)=0 OD |
|||
FOR i=1 TO t(0) |
|||
DO |
|||
c=ToLower(t(i)) |
|||
IF c>='a AND c<='z THEN |
|||
tab(c-'a)=1 |
|||
FI |
|||
OD |
|||
FOR i=0 TO CHAR_COUNT-1 |
|||
DO |
|||
IF tab(i)=0 THEN |
|||
RETURN (0) |
|||
FI |
|||
OD |
|||
RETURN (1) |
|||
PROC Test(CHAR ARRAY t) |
|||
BYTE res |
|||
res=IsPangram(t) |
|||
PrintF("""%S"" is ",t) |
|||
IF res=0 THEN |
|||
Print("not ") |
|||
FI |
|||
PrintE("a pangram.") |
|||
PutE() |
|||
RETURN |
|||
PROC Main() |
|||
Put(125) PutE() ;clear screen |
|||
Test("The quick brown fox jumps over the lazy dog.") |
|||
Test("QwErTyUiOpAsDfGhJkLzXcVbNm") |
|||
Test("Not a pangram") |
|||
Test("") |
|||
RETURN</lang> |
|||
{{out}} |
|||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Pangram_checker.png Screenshot from Atari 8-bit computer] |
|||
<pre> |
|||
"The quick brown fox jumps over the lazy dog." is a pangram. |
|||
"QwErTyUiOpAsDfGhJkLzXcVbNm" is a pangram. |
|||
"Not a pangram" is not a pangram. |
|||
"" is not a pangram. |
|||
</pre> |
|||
=={{header|ActionScript}}== |
=={{header|ActionScript}}== |