Pangram checker: Difference between revisions

From Rosetta Code
Content added Content deleted
imported>Thebeez
(Added uBasic/4tH version)
 
(18 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[[Category:String manipulation]]
[[Category:String manipulation]]


{{task}}
{{task}}
{{omit from|Lilypond}}
{{omit from|Lilypond}}


Line 19: Line 19:


=={{header|11l}}==
=={{header|11l}}==
<lang 11l>F is_pangram(sentence)
<syntaxhighlight lang="11l">F is_pangram(sentence)
R Set(sentence.lowercase().filter(ch -> ch C ‘a’..‘z’)).len == 26
R Set(sentence.lowercase().filter(ch -> ch C ‘a’..‘z’)).len == 26


L(sentence) [‘The quick brown fox jumps over the lazy dog.’,
L(sentence) [‘The quick brown fox jumps over the lazy dog.’,
‘The quick brown fox jumped over the lazy dog.’]
‘The quick brown fox jumped over the lazy dog.’]
print(‘'#.' is #.a pangram’.format(sentence, ‘not ’ * !is_pangram(sentence)))</lang>
print(‘'#.' is #.a pangram’.format(sentence, ‘not ’ * !is_pangram(sentence)))</syntaxhighlight>


{{out}}
{{out}}
Line 33: Line 33:


=={{header|360 Assembly}}==
=={{header|360 Assembly}}==
<lang 360asm>* Pangram RC 11/08/2015
<syntaxhighlight lang="360asm">* Pangram RC 11/08/2015
PANGRAM CSECT
PANGRAM CSECT
USING PANGRAM,R12
USING PANGRAM,R12
Line 49: Line 49:
LA R5,1 found
LA R5,1 found
NEXTK LA R11,1(R11) next character
NEXTK LA R11,1(R11) next character
BCT R8,LOOPK
BCT R8,LOOPK
LTR R5,R5 if found
LTR R5,R5 if found
BNZ NEXTJ
BNZ NEXTJ
Line 55: Line 55:
B PRINT
B PRINT
NEXTJ LA R10,1(R10) next letter
NEXTJ LA R10,1(R10) next letter
BCT R7,LOOPJ
BCT R7,LOOPJ
MVC BUFFER(2),=CL2'OK'
MVC BUFFER(2),=CL2'OK'
PRINT MVC BUFFER+3(60),0(R9)
PRINT MVC BUFFER+3(60),0(R9)
XPRNT BUFFER,80
XPRNT BUFFER,80
NEXTI LA R9,60(R9) next sentence
NEXTI LA R9,60(R9) next sentence
BCT R6,LOOPI
BCT R6,LOOPI
RETURN XR R15,R15
RETURN XR R15,R15
BR R14
BR R14
Line 69: Line 69:
DC CL60'PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.'
DC CL60'PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.'
BUFFER DC CL80' '
BUFFER DC CL80' '
YREGS
YREGS
END PANGRAM</lang>
END PANGRAM</syntaxhighlight>
{{out}}
{{out}}
<pre>OK THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
<pre>OK THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
Line 78: Line 78:


=={{header|ACL2}}==
=={{header|ACL2}}==
<lang Lisp>(defun contains-each (needles haystack)
<syntaxhighlight lang="lisp">(defun contains-each (needles haystack)
(if (endp needles)
(if (endp needles)
t
t
Line 86: Line 86:
(defun pangramp (str)
(defun pangramp (str)
(contains-each (coerce "abcdefghijklmnopqrstuvwxyz" 'list)
(contains-each (coerce "abcdefghijklmnopqrstuvwxyz" 'list)
(coerce (string-downcase str) 'list)))</lang>
(coerce (string-downcase str) 'list)))</syntaxhighlight>


=={{header|Action!}}==
=={{header|Action!}}==
{{libheader|Action! Tool Kit}}
{{libheader|Action! Tool Kit}}
<lang Action!>INCLUDE "D2:CHARTEST.ACT" ;from the Action! Tool Kit
<syntaxhighlight lang="action!">INCLUDE "D2:CHARTEST.ACT" ;from the Action! Tool Kit


DEFINE CHAR_COUNT="26"
DEFINE CHAR_COUNT="26"
Line 135: Line 135:
Test("Not a pangram")
Test("Not a pangram")
Test("")
Test("")
RETURN</lang>
RETURN</syntaxhighlight>
{{out}}
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Pangram_checker.png Screenshot from Atari 8-bit computer]
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Pangram_checker.png Screenshot from Atari 8-bit computer]
Line 150: Line 150:
=={{header|ActionScript}}==
=={{header|ActionScript}}==
{{works with|ActionScript|2.0}}
{{works with|ActionScript|2.0}}
<lang ActionScript>function pangram(k:string):Boolean {
<syntaxhighlight lang="actionscript">function pangram(k:string):Boolean {
var lowerK:String = k.toLowerCase();
var lowerK:String = k.toLowerCase();
var has:Object = {}
var has:Object = {}

for (var i:Number=0; i<=k.length-1; i++) {
for (var i:Number=0; i<=k.length-1; i++) {
has[lowerK.charAt(i)] = true;
has[lowerK.charAt(i)] = true;
}
}

var result:Boolean = true;
var result:Boolean = true;

for (var ch:String='a'; ch <= 'z'; ch=String.fromCharCode(ch.charCodeAt(0)+1)) {
for (var ch:String='a'; ch <= 'z'; ch=String.fromCharCode(ch.charCodeAt(0)+1)) {
result = result && has[ch]
result = result && has[ch]
}
}

return result || false;
return result || false;
}</lang>
}</syntaxhighlight>


=={{header|Ada}}==
=={{header|Ada}}==
=== Using character sets ===
=== Using character sets ===
<lang Ada>with Ada.Text_IO; use Ada.Text_IO;
<syntaxhighlight lang="ada">with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure pangram is
procedure pangram is

function ispangram(txt: String) return Boolean is
function ispangram(txt: String) return Boolean is
(Is_Subset(To_Set(Span => ('a','z')), To_Set(To_Lower(txt))));
(Is_Subset(To_Set(Span => ('a','z')), To_Set(To_Lower(txt))));

begin
begin
put_line(Boolean'Image(ispangram("This is a test")));
put_line(Boolean'Image(ispangram("This is a test")));
Line 183: Line 183:
put_line(Boolean'Image(ispangram("abcdefghijklopqrstuvwxyz"))); --Missing m, n
put_line(Boolean'Image(ispangram("abcdefghijklopqrstuvwxyz"))); --Missing m, n
end pangram;
end pangram;
</syntaxhighlight>
</lang>
=== Using quantified expressions ===
=== Using quantified expressions ===
<lang Ada>with Ada.Text_IO; use Ada.Text_IO;
<syntaxhighlight lang="ada">with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure pangram is
procedure pangram is

function ispangram(txt : in String) return Boolean is
function ispangram(txt : in String) return Boolean is
(for all Letter in Character range 'a'..'z' =>
(for all Letter in Character range 'a'..'z' =>
Line 199: Line 199:
put_line(Boolean'Image(ispangram("abcdefghijklopqrstuvwxyz"))); --Missing m, n
put_line(Boolean'Image(ispangram("abcdefghijklopqrstuvwxyz"))); --Missing m, n
end pangram;
end pangram;
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 214: Line 214:


{{works with|ELLA ALGOL 68|Any (with appropriate job cards)}}
{{works with|ELLA ALGOL 68|Any (with appropriate job cards)}}
<lang algol68># init pangram: #
<syntaxhighlight lang="algol68"># init pangram: #
INT la = ABS "a", lz = ABS "z";
INT la = ABS "a", lz = ABS "z";
INT ua = ABS "A", uz = ABS "Z";
INT ua = ABS "A", uz = ABS "Z";
Line 249: Line 249:
FI
FI
OD
OD
)</lang>
)</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 257: Line 257:


=={{header|APL}}==
=={{header|APL}}==
<lang apl>
<syntaxhighlight lang="apl">
a←'abcdefghijklmnopqrstuvwxyz'
a←'abcdefghijklmnopqrstuvwxyz' ⍝ or ⎕ucs 96 + ⍳26 in GNU/Dyalog
A←'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
A←'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ⍝ or ⎕ucs 64 + ⍳26, or just ⎕a in Dyalog

Panagram←{∧/ ∨⌿ 2 26⍴(a,A) ∊ ⍵}
Pangram ← {∧/ ∨⌿ 2 26⍴(a,A) ∊ ⍵}
Panagram 'This should fail'
Pangram 'This should fail'
0
0
Panagram 'The quick brown fox jumps over the lazy dog'
Pangram 'The quick brown fox jumps over the lazy dog'
1
1
</syntaxhighlight>
</lang>


=={{header|AppleScript}}==
=={{header|AppleScript}}==
Line 274: Line 274:
From OSX 10.10 onwards, we can, however, use ObjC functions from AppleScript by importing the Foundation framework. We do this below to get a toLowerCase() function. If we also add generic filter and map functions, we can write and test a simple isPangram() function as follows:
From OSX 10.10 onwards, we can, however, use ObjC functions from AppleScript by importing the Foundation framework. We do this below to get a toLowerCase() function. If we also add generic filter and map functions, we can write and test a simple isPangram() function as follows:


<lang AppleScript>use framework "Foundation" -- ( for case conversion function )
<syntaxhighlight lang="applescript">use framework "Foundation" -- ( for case conversion function )


--------------------- PANGRAM CHECKER --------------------
--------------------- PANGRAM CHECKER --------------------
Line 286: Line 286:
end |λ|
end |λ|
end script
end script

0 = length of filter(charUnUsed, ¬
0 = length of filter(charUnUsed, ¬
"abcdefghijklmnopqrstuvwxyz")
"abcdefghijklmnopqrstuvwxyz")
Line 297: Line 297:
"is this a pangram", ¬
"is this a pangram", ¬
"The quick brown fox jumps over the lazy dog"})
"The quick brown fox jumps over the lazy dog"})

--> {false, true}
--> {false, true}
end run
end run
Line 331: Line 331:




-- Lift 2nd class handler function into
-- Lift 2nd class handler function into
-- 1st class script wrapper
-- 1st class script wrapper
-- mReturn :: Handler -> Script
-- mReturn :: Handler -> Script
on mReturn(f)
on mReturn(f)
Line 350: Line 350:
((ca's NSString's stringWithString:(str))'s ¬
((ca's NSString's stringWithString:(str))'s ¬
lowercaseStringWithLocale:(ca's NSLocale's currentLocale())) as text
lowercaseStringWithLocale:(ca's NSLocale's currentLocale())) as text
end toLower</lang>
end toLower</syntaxhighlight>
{{Out}}
{{Out}}
<lang AppleScript>{false, true}</lang>
<syntaxhighlight lang="applescript">{false, true}</syntaxhighlight>
----
----
===Core language===
===Core language===
Contrary to the impression given above, AppleScript is perfectly capable of handling this task very simply and without the need for imported libraries.
Contrary to the impression given above, AppleScript is perfectly capable of handling this task very simply and without the need for imported libraries.
<lang applescript>on isPangram(txt)
<syntaxhighlight lang="applescript">on isPangram(txt)
set alphabet to "abcedfghijklmnopqrstuvwxyz"
set alphabet to "abcedfghijklmnopqrstuvwxyz"
ignoring case -- The default, but ensure it here.
ignoring case -- The default, but ensure it here.
Line 363: Line 363:
end repeat
end repeat
end ignoring
end ignoring

return true
return true
end isPangram
end isPangram
Line 370: Line 370:
set result1 to isPangram("The Quick Brown Fox Jumps Over The Lazy Dog")
set result1 to isPangram("The Quick Brown Fox Jumps Over The Lazy Dog")
set result2 to isPangram("This is not a pangram")
set result2 to isPangram("This is not a pangram")
return {result1, result2}</lang>
return {result1, result2}</syntaxhighlight>


{{output}}
{{output}}
<lang applescript>{true, false}</lang>
<syntaxhighlight lang="applescript">{true, false}</syntaxhighlight>


=={{header|Arturo}}==
=={{header|Arturo}}==
<lang rebol>chars: map 97..122 => [to :string to :char &]
<syntaxhighlight lang="rebol">chars: map 97..122 => [to :string to :char &]
pangram?: function [sentence][
pangram?: function [sentence][
every? chars 'ch ->
every? chars 'ch ->
Line 383: Line 383:


print pangram? "this is a sentence"
print pangram? "this is a sentence"
print pangram? "The quick brown fox jumps over the lazy dog."</lang>
print pangram? "The quick brown fox jumps over the lazy dog."</syntaxhighlight>


{{out}}
{{out}}
Line 391: Line 391:


=={{header|ATS}}==
=={{header|ATS}}==
<syntaxhighlight lang="ats">
<lang ATS>
(* ****** ****** *)
(* ****** ****** *)
//
//
Line 437: Line 437:


(* ****** ****** *)
(* ****** ****** *)
</syntaxhighlight>
</lang>


An alternate implementation that makes a single pass through the string:
An alternate implementation that makes a single pass through the string:


<lang ATS>fn is_pangram{n:nat}(s: string(n)): bool = loop(s, i2sz(0)) where {
<syntaxhighlight lang="ats">fn is_pangram{n:nat}(s: string(n)): bool = loop(s, i2sz(0)) where {
val letters: arrayref(bool, 26) = arrayref_make_elt<bool>(i2sz(26), false)
val letters: arrayref(bool, 26) = arrayref_make_elt<bool>(i2sz(26), false)
fn check(): bool = loop(0) where {
fn check(): bool = loop(0) where {
Line 460: Line 460:
end
end
}
}
</syntaxhighlight>
</lang>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<lang autohotkey>Gui, -MinimizeBox
<syntaxhighlight lang="autohotkey">Gui, -MinimizeBox
Gui, Add, Edit, w300 r5 vText
Gui, Add, Edit, w300 r5 vText
Gui, Add, Button, x105 w100 Default, Check Pangram
Gui, Add, Button, x105 w100 Default, Check Pangram
Line 481: Line 481:
}
}
MsgBox,, Pangram, OK`, this is a Pangram!
MsgBox,, Pangram, OK`, this is a Pangram!
Return</lang>
Return</syntaxhighlight>


=={{header|AutoIt}}==
=={{header|AutoIt}}==
<lang autoit>
<syntaxhighlight lang="autoit">
Pangram("The quick brown fox jumps over the lazy dog")
Pangram("The quick brown fox jumps over the lazy dog")
Func Pangram($s_String)
Func Pangram($s_String)
Line 494: Line 494:
Return MsgBox(0,"Pangram", "Sentence is a Pangram")
Return MsgBox(0,"Pangram", "Sentence is a Pangram")
EndFunc
EndFunc
</syntaxhighlight>
</lang>


=={{header|AWK}}==
=={{header|AWK}}==


===Solution using string-operations===
===Solution using string-operations===
<lang AWK>#!/usr/bin/awk -f
<syntaxhighlight lang="awk">#!/usr/bin/awk -f
BEGIN {
BEGIN {
allChars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
allChars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Line 513: Line 513:
for (k=1; k<=length(allChars); k++) {
for (k=1; k<=length(allChars); k++) {
if (!X[substr(allChars,k,1)]) return 0;
if (!X[substr(allChars,k,1)]) return 0;
}
}
return 1;
return 1;
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 524: Line 524:
{{Works with|gawk|4.1.0}}
{{Works with|gawk|4.1.0}}
{{Works with|mawk|1.3.3}}
{{Works with|mawk|1.3.3}}
<lang AWK># usage: awk -f pangram.awk -v p="The five boxing wizards dump quickly." input.txt
<syntaxhighlight lang="awk"># usage: awk -f pangram.awk -v p="The five boxing wizards dump quickly." input.txt
#
#
# Pangram-checker, using associative arrays and split
# Pangram-checker, using associative arrays and split
Line 550: Line 550:
}
}
print "# hit:",hit, "# miss:",miss, "." ##
print "# hit:",hit, "# miss:",miss, "." ##
if (miss) return 0
if (miss) return 0
return 1
return 1
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 575: Line 575:


=={{header|BASIC}}==
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
{{works with|QBasic}}
<syntaxhighlight lang="gwbasic"> 100 P$ = "11111111111111111111111111"
110 FOR Q = 1 TO 3
120 READ S$
130 GOSUB 200"IS PANGRAM?
140 PRINT MID$ ("NO YES ",P * 4 + 1,4)S$
150 NEXT Q
160 END
170 DATA"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG."
180 DATA"THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG."
190 DATA"THE FIVE BOXING WIZARDS JUMP QUICKLY."
200 P = 0:L = LEN (S$): IF NOT L THEN RETURN
210 F$ = "00000000000000000000000000"
220 FOR I = 1 TO L
230 C = ASC ( MID$ (S$,I,1)):C = C - 32 * (C > 95): IF C > 64 AND C < 91 THEN J = C - 64:F$ = MID$ (F$,1,J - 1) + "1" + MID$ (F$,J + 1):P = F$ = P$: IF P THEN RETURN
240 NEXT I
250 RETURN</syntaxhighlight>
{{out}}
<pre>
YES THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
NO THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.
YES THE FIVE BOXING WIZARDS JUMP QUICKLY.
</pre>
==={{header|BaCon}}===
This can be done in a one-liner.
<syntaxhighlight lang="bacon">DEF FN Pangram(x) = IIF(AMOUNT(UNIQ$(EXPLODE$(EXTRACT$(LCASE$(x), "[^[:alpha:]]", TRUE), 1))) = 26, TRUE, FALSE)

PRINT Pangram("The quick brown fox jumps over the lazy dog.")
PRINT Pangram("Jackdaws love my big sphinx of quartz.")
PRINT Pangram("My dog has fleas.")
PRINT Pangram("What's a jackdaw?")
PRINT Pangram("The five boxing wizards jump quickly")</syntaxhighlight>
{{out}}
<pre>1
1
0
0
1
</pre>

==={{header|BASIC256}}===
<syntaxhighlight lang="freebasic">function isPangram$(texto$)
longitud = Length(texto$)
if longitud < 26 then return "is not a pangram"
t$ = lower(texto$)
print "'"; texto$; "' ";
for i = 97 to 122
if instr(t$, chr(i)) = 0 then return "is not a pangram"
next i
return "is a pangram"
end function

print isPangram$("The quick brown fox jumps over the lazy dog.") # --> true
print isPangram$("The quick brown fox jumped over the lazy dog.") # --> false
print isPangram$("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ") # --> true</syntaxhighlight>

==={{header|BBC BASIC}}===
<syntaxhighlight lang="bbcbasic"> FOR test% = 1 TO 2
READ test$
PRINT """" test$ """ " ;
IF FNpangram(test$) THEN
PRINT "is a pangram"
ELSE
PRINT "is not a pangram"
ENDIF
NEXT test%
END

DATA "The quick brown fox jumped over the lazy dog"
DATA "The five boxing wizards jump quickly"

DEF FNpangram(A$)
LOCAL C%
A$ = FNlower(A$)
FOR C% = ASC("a") TO ASC("z")
IF INSTR(A$, CHR$(C%)) = 0 THEN = FALSE
NEXT
= TRUE

DEF FNlower(A$)
LOCAL A%, C%
FOR A% = 1 TO LEN(A$)
C% = ASCMID$(A$,A%)
IF C% >= 65 IF C% <= 90 MID$(A$,A%,1) = CHR$(C%+32)
NEXT
= A$</syntaxhighlight>
{{out}}
<pre>"The quick brown fox jumped over the lazy dog" is not a pangram
"The five boxing wizards jump quickly" is a pangram</pre>

String manipulation is expensive, especially in loops, so it may be better to buffer the string and use character values:

<pre>DEFFNisPangram(text$)
LOCAL size%,text%,char%,bits%
size%=LENtext$
IF size%<27 THEN =FALSE:REM too few characters
DIM text% LOCAL size%:REM BB4W and RISC OS 5 only
$text%=text$:REM buffer the string
FOR text%=text% TO text%+size%-1:REM each character
char%=?text% OR 32:REM to lower case
IF 96<char% AND char%<123 THEN bits%=bits% OR 1<<(char%-97):REM set ordinal bit
IF bits%=&3FFFFFF THEN =TRUE:REM all ordinal bits set
NEXT text%
=FALSE</pre>

==={{header|Commodore BASIC}}===
<syntaxhighlight lang="gwbasic">10 rem detect model for title display
20 mx=peek(213): if mx=21 or mx=39 or mx=79 then 50:rem pet, vic, c64
30 mx=peek(238): if mx=39 or mx=79 then 50: rem c128
40 mx=39:color 4,1:rem assume plus/4 or c-16
50 if mx=21 then poke 36879,30:rem fix color on vic-20
60 print chr$(147);chr$(14);chr$(18);"**";:for i=2 to (mx-15)/2:print " ";:next
70 print "Pangram Checker";
80 for i=(mx-15)/2+16 to mx-2: print " ";: next: print "**"
100 read s$
110 if len(s$)=0 then end
120 gosub 1000:print
130 print "'"s$"' is";
140 if p=0 then print " not";
150 print " a pangram."
160 goto 100
500 data "The quick brown fox jumps over the lazy dog."
510 data "The quick brown fox jumped over the lazy dog."
520 data "The five boxing wizards jump quickly."
530 data
900 rem pangram checker
1000 if f=0 then f=1:dim seen(25),a(2):a(0)=65:a(1)=97:a(2)=193:goto 1020
1010 for i=0 to 25:seen(i)=0:next
1020 for i=1 to len(s$)
1030 : c=asc(mid$(s$,i))
1040 : for a = 0 to 2
1050 : if c>=a(a) and c<=a(a)+25 then seen(c-a(a))=seen(c-a(a))+1
1060 : next a
1070 next i
1080 p=-1
1090 for i=0 to 25
1100 : if seen(i)=0 then p=0:i=25
1110 next i
1120 return</syntaxhighlight>

{{Out}}
<pre>** Pangram Checker **


'The quick brown fox jumps over the lazy dog.' is a pangram.

'The quick brown fox jumped over the lazy dog.' is not a pangram.

'The five boxing wizards jump quickly.' is a pangram.

ready.</pre>

==={{header|Chipmunk Basic}}===
The [[#Applesoft BASIC|Applesoft BASIC]] solution works without any changes.

==={{header|FreeBASIC}}===
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64

Function isPangram(s As Const String) As Boolean
Dim As Integer length = Len(s)
If length < 26 Then Return False
Dim p As String = LCase(s)
For i As Integer = 97 To 122
If Instr(p, Chr(i)) = 0 Then Return False
Next
Return True
End Function

Dim s(1 To 3) As String = _
{ _
"The quick brown fox jumps over the lazy dog", _
"abbdefghijklmnopqrstuVwxYz", _ '' no c!
"How vexingly quick daft zebras jump!" _
}

For i As Integer = 1 To 3:
Print "'"; s(i); "' is "; IIf(isPangram(s(i)), "a", "not a"); " pangram"
Print
Next

Print
Print "Press nay key to quit"
Sleep</syntaxhighlight>

{{out}}
<pre>
'The quick brown fox jumps over the lazy dog' is a pangram

'abbdefghijklmnopqrstuVwxYz' is not a pangram

'How vexingly quick daft zebras jump!' is a pangram
</pre>

==={{header|Liberty BASIC}}===
<syntaxhighlight lang="lb">'Returns 0 if the string is NOT a pangram or >0 if it IS a pangram
string$ = "The quick brown fox jumps over the lazy dog."

Print isPangram(string$)

Function isPangram(string$)
string$ = Lower$(string$)
For i = Asc("a") To Asc("z")
isPangram = Instr(string$, chr$(i))
If isPangram = 0 Then Exit Function
Next i
End Function</syntaxhighlight>

==={{header|PureBasic}}===
<syntaxhighlight lang="purebasic">Procedure IsPangram_fast(String$)
String$ = LCase(string$)
char_a=Asc("a")
; sets bits in a variable if a letter is found, reads string only once
For a = 1 To Len(string$)
char$ = Mid(String$, a, 1)
pos = Asc(char$) - char_a
check.l | 1 << pos
Next
If check & $3FFFFFF = $3FFFFFF
ProcedureReturn 1
EndIf
ProcedureReturn 0
EndProcedure

Procedure IsPangram_simple(String$)
String$ = LCase(string$)
found = 1
For a = Asc("a") To Asc("z")
; searches for every letter in whole string
If FindString(String$, Chr(a), 0) = 0
found = 0
EndIf
Next
ProcedureReturn found
EndProcedure

Debug IsPangram_fast("The quick brown fox jumps over lazy dogs.")
Debug IsPangram_simple("The quick brown fox jumps over lazy dogs.")
Debug IsPangram_fast("No pangram")
Debug IsPangram_simple("No pangram")</syntaxhighlight>


==={{header|QBasic}}===


<lang qbasic>DECLARE FUNCTION IsPangram! (sentence AS STRING)
<syntaxhighlight lang="qbasic">DECLARE FUNCTION IsPangram! (sentence AS STRING)


DIM x AS STRING
DIM x AS STRING
Line 618: Line 859:


IsPangram! = -1
IsPangram! = -1
END FUNCTION</lang>
END FUNCTION</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 626: Line 867:
0 What's a jackdaw?
0 What's a jackdaw?
</pre>
</pre>

==={{header|Run BASIC}}===
<syntaxhighlight lang="runbasic">s$ = "The quick brown fox jumps over the lazy dog."
Print pangram(s$);" ";s$

s$ = "My dog has fleas."
Print pangram(s$);" ";s$

function pangram(str$)
str$ = lower$(str$)
for i = asc("a") to asc("z")
pangram = pangram + (instr(str$, chr$(i)) <> 0)
next i
pangram = (pangram = 26)
end function</syntaxhighlight><pre>1 The quick brown fox jumps over the lazy dog.
0 My dog has fleas.</pre>


==={{header|Sinclair ZX81 BASIC}}===
==={{header|Sinclair ZX81 BASIC}}===
Works (just) with the 1k RAM model. The "37" that crops up a couple of times stops being a mystery if we remember that the ZX81 character code for <code>A</code> is 38 and that strings (like arrays) are indexed from 1, not from 0.
Works (just) with the 1k RAM model. The "37" that crops up a couple of times stops being a mystery if we remember that the ZX81 character code for <code>A</code> is 38 and that strings (like arrays) are indexed from 1, not from 0.
<lang basic> 10 LET A$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
<syntaxhighlight lang="basic"> 10 LET A$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
20 LET L=26
20 LET L=26
30 INPUT P$
30 INPUT P$
Line 646: Line 903:
160 GOTO 180
160 GOTO 180
170 PRINT "NOT A PANGRAM"
170 PRINT "NOT A PANGRAM"
180 SLOW</lang>
180 SLOW</syntaxhighlight>
{{in}}
{{in}}
<pre>THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.</pre>
<pre>THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.</pre>
Line 656: Line 913:
<pre>NOT A PANGRAM</pre>
<pre>NOT A PANGRAM</pre>


==={{header|BaCon}}===
==={{header|uBasic/4tH}}===
<syntaxhighlight lang="basic">Proc _ShowPangram ("The quick brown fox jumps over the lazy dog.")
This can be done in a one-liner.
Proc _ShowPangram ("QwErTyUiOpAsDfGhJkLzXcVbNm")
<lang bacon>DEF FN Pangram(x) = IIF(AMOUNT(UNIQ$(EXPLODE$(EXTRACT$(LCASE$(x), "[^[:alpha:]]", TRUE), 1))) = 26, TRUE, FALSE)
Proc _ShowPangram ("Not a pangram")


End
PRINT Pangram("The quick brown fox jumps over the lazy dog.")
PRINT Pangram("Jackdaws love my big sphinx of quartz.")
PRINT Pangram("My dog has fleas.")
PRINT Pangram("What's a jackdaw?")
PRINT Pangram("The five boxing wizards jump quickly")</lang>
{{out}}
<pre>1
1
0
0
1
</pre>


_ShowPangram ' demonstrate the Pangram() function
Param (1)
Print Show (a@);Tab (50);Show (Iif (FUNC(_Pangram (a@)), "A pangram", "Not a pangram"))
Return


_Pangram
=={{header|BASIC256}}==
Param (1) ' pangram candidate
<lang freebasic>function isPangram$(texto$)
Local (3)
longitud = Length(texto$)
if longitud < 26 then return "is not a pangram"
t$ = lower(texto$)
print "'"; texto$; "' ";
for i = 97 to 122
if instr(t$, chr(i)) = 0 then return "is not a pangram"
next i
return "is a pangram"
end function


b@ = 0 ' reset the bitmap
print isPangram$("The quick brown fox jumps over the lazy dog.") # --> true
print isPangram$("The quick brown fox jumped over the lazy dog.") # --> false
print isPangram$("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ") # --> true</lang>


For d@ = 0 To Len(a@) -1 ' parse the string
c@ = Peek (a@, d@) ' get current character
If (c@ > Ord ("A") - 1) * (c@ < Ord ("Z") + 1) Then c@ = c@ + 32
If (c@ > Ord ("a") - 1) * (c@ < Ord ("z") + 1) Then b@ = OR(b@, 2^(c@ - Ord ("a")))
Next ' update the bitmap
Return (b@ = 67108863) ' all bits set?</syntaxhighlight>
{{Out}}
<pre>The quick brown fox jumps over the lazy dog. A pangram
QwErTyUiOpAsDfGhJkLzXcVbNm A pangram
Not a pangram Not a pangram

0 OK, 0:156</pre>
==={{header|Yabasic}}===
<syntaxhighlight lang="yabasic">sub isPangram$(t$, l1$)
local lt, ll, r$, i, cc, ic

if numparams = 1 then
l1$ = "abcdefghijklmnopqrstuvwxyz"
end if

t$ = lower$(t$)
ll = len(l1$)
for i = 1 to ll
r$ = r$ + " "
next
lt = len(t$)
cc = asc("a")

for i = 1 to lt
ic = asc(mid$(t$, i, 1)) - cc + 1
if ic > 0 and ic <= ll then
mid$(r$, ic, 1) = chr$(ic + cc - 1)
end if
next i

if l1$ = r$ then return "true" else return "false" end if

end sub

print isPangram$("The quick brown fox jumps over the lazy dog.") // --> true
print isPangram$("The quick brown fox jumped over the lazy dog.") // --> false
print isPangram$("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ") // --> true</syntaxhighlight>


=={{header|Batch File}}==
=={{header|Batch File}}==
<lang dos>@echo off
<syntaxhighlight lang="dos">@echo off
setlocal enabledelayedexpansion
setlocal enabledelayedexpansion


Line 721: Line 1,004:
set letters=!letters:%chr%=!
set letters=!letters:%chr%=!
set /a cnt+=1
set /a cnt+=1
goto loop</lang>
goto loop</syntaxhighlight>
{{Out}}
{{Out}}
<pre>"The quick brown fox jumps over the lazy dog." is a pangram!
<pre>"The quick brown fox jumps over the lazy dog." is a pangram!
Line 727: Line 1,010:


Press any key to continue . . .</pre>
Press any key to continue . . .</pre>

=={{header|BBC BASIC}}==
<lang bbcbasic> FOR test% = 1 TO 2
READ test$
PRINT """" test$ """ " ;
IF FNpangram(test$) THEN
PRINT "is a pangram"
ELSE
PRINT "is not a pangram"
ENDIF
NEXT test%
END
DATA "The quick brown fox jumped over the lazy dog"
DATA "The five boxing wizards jump quickly"
DEF FNpangram(A$)
LOCAL C%
A$ = FNlower(A$)
FOR C% = ASC("a") TO ASC("z")
IF INSTR(A$, CHR$(C%)) = 0 THEN = FALSE
NEXT
= TRUE
DEF FNlower(A$)
LOCAL A%, C%
FOR A% = 1 TO LEN(A$)
C% = ASCMID$(A$,A%)
IF C% >= 65 IF C% <= 90 MID$(A$,A%,1) = CHR$(C%+32)
NEXT
= A$</lang>
{{out}}
<pre>"The quick brown fox jumped over the lazy dog" is not a pangram
"The five boxing wizards jump quickly" is a pangram</pre>

String manipulation is expensive, especially in loops, so it may be better to buffer the string and use character values:

<pre>DEFFNisPangram(text$)
LOCAL size%,text%,char%,bits%
size%=LENtext$
IF size%<27 THEN =FALSE:REM too few characters
DIM text% LOCAL size%:REM BB4W and RISC OS 5 only
$text%=text$:REM buffer the string
FOR text%=text% TO text%+size%-1:REM each character
char%=?text% OR 32:REM to lower case
IF 96<char% AND char%<123 THEN bits%=bits% OR 1<<(char%-97):REM set ordinal bit
IF bits%=&3FFFFFF THEN =TRUE:REM all ordinal bits set
NEXT text%
=FALSE</pre>


=={{header|BCPL}}==
=={{header|BCPL}}==
<lang bcpl>get "libhdr"
<syntaxhighlight lang="bcpl">get "libhdr"


// Test if s is a pangram. The ASCII character set is assumed.
// Test if s is a pangram. The ASCII character set is assumed.
Line 805: Line 1,039:
$( check("The quick brown fox jumps over the lazy dog.")
$( check("The quick brown fox jumps over the lazy dog.")
check("The five boxing wizards dump quickly.")
check("The five boxing wizards dump quickly.")
$)</lang>
$)</syntaxhighlight>
{{out}}
{{out}}
<pre>The quick brown fox jumps over the lazy dog. -> yes
<pre>The quick brown fox jumps over the lazy dog. -> yes
Line 814: Line 1,048:
Reads the sentence to test from stdin.
Reads the sentence to test from stdin.


<lang befunge>>~>:65*`!#v_:"`"`48*v>g+04p1\4p
<syntaxhighlight lang="befunge">>~>:65*`!#v_:"`"`48*v>g+04p1\4p
^#*`\*93\`0<::-"@"-*<^40!%2g4:_
^#*`\*93\`0<::-"@"-*<^40!%2g4:_
"pangram."<v*84<_v#-":"g40\" a"
"pangram."<v*84<_v#-":"g40\" a"
>>:#,_55+,@>"ton">48*>"si tahT"</lang>
>>:#,_55+,@>"ton">48*>"si tahT"</syntaxhighlight>


{{in}}
{{in}}
Line 826: Line 1,060:


=={{header|Bracmat}}==
=={{header|Bracmat}}==
<lang bracmat>(isPangram=
<syntaxhighlight lang="bracmat">(isPangram=
k
k
. low$!arg:?arg
. low$!arg:?arg
Line 835: Line 1,069:
)
)
& !k:>z
& !k:>z
&
&
);</lang>
);</syntaxhighlight>
Some examples:
Some examples:
<pre>isPangram$("the Quick brown FOX jumps over the lazy do")
<pre>isPangram$("the Quick brown FOX jumps over the lazy do")
Line 854: Line 1,088:


=={{header|Brat}}==
=={{header|Brat}}==
<lang brat>pangram? = { sentence |
<syntaxhighlight lang="brat">pangram? = { sentence |
letters = [:a :b :c :d :e :f :g :h :i :j :k :l :m
letters = [:a :b :c :d :e :f :g :h :i :j :k :l :m
:n :o :p :q :r :s :t :u :v :w :x :y :z]
:n :o :p :q :r :s :t :u :v :w :x :y :z]
Line 868: Line 1,102:


p pangram? 'The quick brown fox jumps over the lazy dog.' #Prints true
p pangram? 'The quick brown fox jumps over the lazy dog.' #Prints true
p pangram? 'Probably not a pangram.' #Prints false</lang>
p pangram? 'Probably not a pangram.' #Prints false</syntaxhighlight>


Alternative version:
Alternative version:


<lang brat>pangram? = { sentence |
<syntaxhighlight lang="brat">pangram? = { sentence |
sentence.downcase.dice.unique.select(:alpha?).length == 26
sentence.downcase.dice.unique.select(:alpha?).length == 26
}</lang>
}</syntaxhighlight>


=={{header|C}}==
=={{header|C}}==
<lang C>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>


int is_pangram(const char *s)
int is_pangram(const char *s)
Line 917: Line 1,151:
tests[i], is_pangram(tests[i])?"":"not ");
tests[i], is_pangram(tests[i])?"":"not ");
return 0;
return 0;
}</lang>
}</syntaxhighlight>
===Using bitmask===
===Using bitmask===
Assumes an execution environment using the ASCII character set (will invoke undefined behavior on other systems).
Assumes an execution environment using the ASCII character set (will invoke undefined behavior on other systems).


<lang c>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>


int pangram(const char *s)
int pangram(const char *s)
Line 943: Line 1,177:


return 0;
return 0;
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>yes: The quick brown fox jumps over lazy dogs.
<pre>yes: The quick brown fox jumps over lazy dogs.
Line 951: Line 1,185:
C# 3.0 or higher (.NET Framework 3.5 or higher)
C# 3.0 or higher (.NET Framework 3.5 or higher)


<lang csharp>using System;
<syntaxhighlight lang="csharp">using System;
using System.Linq;
using System.Linq;


Line 965: Line 1,199:
Console.WriteLine(arguments.Any() && arguments.First().IsPangram());
Console.WriteLine(arguments.Any() && arguments.First().IsPangram());
}
}
}</lang>
}</syntaxhighlight>


Any version of C# language and .NET Framework
Any version of C# language and .NET Framework


<lang csharp>using System;
<syntaxhighlight lang="csharp">using System;


namespace PangrammChecker
namespace PangrammChecker
Line 1,008: Line 1,242:
}
}
}
}
}</lang>
}</syntaxhighlight>


=={{header|C++}}==
=={{header|C++}}==
<lang cpp>#include <algorithm>
<syntaxhighlight lang="cpp">#include <algorithm>
#include <cctype>
#include <cctype>
#include <string>
#include <string>
Line 1,035: Line 1,269:
}
}
}
}
</syntaxhighlight>
</lang>


=={{header|Ceylon}}==
=={{header|Ceylon}}==
<lang ceylon>shared void run() {
<syntaxhighlight lang="ceylon">shared void run() {

function pangram(String sentence) =>
function pangram(String sentence) =>
let(alphabet = set('a'..'z'),
let(alphabet = set('a'..'z'),
Line 1,054: Line 1,288:
print("\"``sentence``\" is a pangram? ``pangram(sentence)``");
print("\"``sentence``\" is a pangram? ``pangram(sentence)``");
}
}
}</lang>
}</syntaxhighlight>


=={{header|Clojure}}==
=={{header|Clojure}}==
<lang lisp>(defn pangram? [s]
<syntaxhighlight lang="lisp">(defn pangram? [s]
(let [letters (into #{} "abcdefghijklmnopqrstuvwxyz")]
(let [letters (into #{} "abcdefghijklmnopqrstuvwxyz")]
(= (->> s .toLowerCase (filter letters) (into #{})) letters)))</lang>
(= (->> s .toLowerCase (filter letters) (into #{})) letters)))</syntaxhighlight>


=={{header|CLU}}==
=={{header|CLU}}==
<lang clu>pangram = proc (s: string) returns (bool)
<syntaxhighlight lang="clu">pangram = proc (s: string) returns (bool)
letters: array[bool] := array[bool]$fill(0,26,false)
letters: array[bool] := array[bool]$fill(0,26,false)
for c: char in string$chars(s) do
for c: char in string$chars(s) do
if c>='a' & c<='z' then
if c>='a' & c<='z' then
c := char$i2c(char$c2i(c) - 32)
c := char$i2c(char$c2i(c) - 32)
end
end
Line 1,085: Line 1,319:
"abcdefghijklmnopqrstuvwxyz"
"abcdefghijklmnopqrstuvwxyz"
]
]

for example: string in array[string]$elements(examples) do
for example: string in array[string]$elements(examples) do
stream$puts(po, "\"" || example || "\" is")
stream$puts(po, "\"" || example || "\" is")
Line 1,093: Line 1,327:
stream$putl(po, " a pangram.")
stream$putl(po, " a pangram.")
end
end
end start_up</lang>
end start_up</syntaxhighlight>
{{out}}
{{out}}
<pre>"The quick brown fox jumps over the lazy dog." is a pangram.
<pre>"The quick brown fox jumps over the lazy dog." is a pangram.
Line 1,100: Line 1,334:


=={{header|COBOL}}==
=={{header|COBOL}}==
<lang COBOL> identification division.
<syntaxhighlight lang="cobol"> identification division.
program-id. pan-test.
program-id. pan-test.
data division.
data division.
Line 1,150: Line 1,384:
exit program
exit program
.
.
end program pangram.</lang>
end program pangram.</syntaxhighlight>


=={{header|CoffeeScript}}==
=={{header|CoffeeScript}}==
<lang coffeescript>
<syntaxhighlight lang="coffeescript">
is_pangram = (s) ->
is_pangram = (s) ->
# This is optimized for longish strings--as soon as all 26 letters
# This is optimized for longish strings--as soon as all 26 letters
Line 1,163: Line 1,397:
for i in [a_code...a_code+26]
for i in [a_code...a_code+26]
required_letters[String.fromCharCode(i)] = true
required_letters[String.fromCharCode(i)] = true

cnt = 0
cnt = 0
for c in s
for c in s
Line 1,188: Line 1,422:
throw Error("fail") if is_pangram(long_str) != exp_value
throw Error("fail") if is_pangram(long_str) != exp_value
console.log "Passed tests: #{s}"
console.log "Passed tests: #{s}"
</syntaxhighlight>
</lang>


=={{header|Comal}}==
=={{header|Comal}}==
<lang comal>0010 FUNC pangram#(s$) CLOSED
<syntaxhighlight lang="comal">0010 FUNC pangram#(s$) CLOSED
0020 FOR i#:=ORD("A") TO ORD("Z") DO
0020 FOR i#:=ORD("A") TO ORD("Z") DO
0030 IF NOT (CHR$(i#) IN s$ OR CHR$(i#+32) IN s$) THEN RETURN FALSE
0030 IF NOT (CHR$(i#) IN s$ OR CHR$(i#+32) IN s$) THEN RETURN FALSE
Line 1,206: Line 1,440:
0140 END
0140 END
0150 DATA "The quick brown fox jumps over the lazy dog."
0150 DATA "The quick brown fox jumps over the lazy dog."
0160 DATA "The five boxing wizards dump quickly."</lang>
0160 DATA "The five boxing wizards dump quickly."</syntaxhighlight>
{{out}}
{{out}}
<pre>'The quick brown fox jumps over the lazy dog.' is a pangram
<pre>'The quick brown fox jumps over the lazy dog.' is a pangram
Line 1,212: Line 1,446:


=={{header|Common Lisp}}==
=={{header|Common Lisp}}==
<lang lisp>(defun pangramp (s)
<syntaxhighlight lang="lisp">(defun pangramp (s)
(null (set-difference
(null (set-difference
(loop for c from (char-code #\A) upto (char-code #\Z) collect (code-char c))
(loop for c from (char-code #\A) upto (char-code #\Z) collect (code-char c))
(coerce (string-upcase s) 'list))))</lang>
(coerce (string-upcase s) 'list))))</syntaxhighlight>


=={{header|Component Pascal}}==
=={{header|Component Pascal}}==
BlackBox Component Builder
BlackBox Component Builder
<lang oberon2>
<syntaxhighlight lang="oberon2">
MODULE BbtPangramChecker;
MODULE BbtPangramChecker;
IMPORT StdLog,DevCommanders,TextMappers;
IMPORT StdLog,DevCommanders,TextMappers;


PROCEDURE Check(str: ARRAY OF CHAR): BOOLEAN;
PROCEDURE Check(str: ARRAY OF CHAR): BOOLEAN;
CONST
CONST
letters = 26;
letters = 26;
VAR
VAR
i,j: INTEGER;
i,j: INTEGER;
status: ARRAY letters OF BOOLEAN;
status: ARRAY letters OF BOOLEAN;
resp : BOOLEAN;
resp : BOOLEAN;
BEGIN
BEGIN
FOR i := 0 TO LEN(status) -1 DO status[i] := FALSE END;
FOR i := 0 TO LEN(status) -1 DO status[i] := FALSE END;

FOR i := 0 TO LEN(str) - 1 DO
FOR i := 0 TO LEN(str) - 1 DO
j := ORD(CAP(str[i])) - ORD('A');
j := ORD(CAP(str[i])) - ORD('A');
IF (0 <= j) & (25 >= j) & ~status[j] THEN status[j] := TRUE END
IF (0 <= j) & (25 >= j) & ~status[j] THEN status[j] := TRUE END
END;
END;

resp := TRUE;
resp := TRUE;
FOR i := 0 TO LEN(status) - 1 DO;
FOR i := 0 TO LEN(status) - 1 DO;
Line 1,268: Line 1,502:


END BbtPangramChecker.
END BbtPangramChecker.
</syntaxhighlight>
</lang>
Execute: ^Q BbtPangramChecker.Do "The quick brown fox jumps over the lazy dog"~ <br/>
Execute: ^Q BbtPangramChecker.Do "The quick brown fox jumps over the lazy dog"~ <br/>
^Q BbtPangramChecker.Do "abcdefghijklmnopqrstuvwxyz"~<br/>
^Q BbtPangramChecker.Do "abcdefghijklmnopqrstuvwxyz"~<br/>
Line 1,280: Line 1,514:


=={{header|Cowgol}}==
=={{header|Cowgol}}==
<lang cowgol>include "cowgol.coh";
<syntaxhighlight lang="cowgol">include "cowgol.coh";


sub pangram(str: [uint8]): (r: uint8) is
sub pangram(str: [uint8]): (r: uint8) is
var letters: uint8[26];
var letters: uint8[26];
MemZero(&letters[0], 26);
MemZero(&letters[0], 26);

loop
loop
var chr := [str];
var chr := [str];
Line 1,294: Line 1,528:
letters[chr] := letters[chr] | 1;
letters[chr] := letters[chr] | 1;
end loop;
end loop;

r := 1;
r := 1;
chr := 0;
chr := 0;
Line 1,315: Line 1,549:
print(yesno[pangram(test[i])]);
print(yesno[pangram(test[i])]);
i := i + 1;
i := i + 1;
end loop;</lang>
end loop;</syntaxhighlight>


{{out}}
{{out}}
Line 1,326: Line 1,560:
Copied and modified from the Ruby version.
Copied and modified from the Ruby version.


<lang ruby>def pangram?(sentence)
<syntaxhighlight lang="ruby">def pangram?(sentence)
('a'..'z').all? {|c| sentence.downcase.includes?(c) }
('a'..'z').all? {|c| sentence.downcase.includes?(c) }
end
end

p pangram?("not a pangram")
p pangram?("not a pangram")
p pangram?("The quick brown fox jumps over the lazy dog.")</lang>
p pangram?("The quick brown fox jumps over the lazy dog.")</syntaxhighlight>


<pre>
<pre>
Line 1,340: Line 1,574:
=={{header|D}}==
=={{header|D}}==
===ASCII Bitmask version===
===ASCII Bitmask version===
<lang d>bool isPangram(in string text) pure nothrow @safe @nogc {
<syntaxhighlight lang="d">bool isPangram(in string text) pure nothrow @safe @nogc {
uint bitset;
uint bitset;


Line 1,358: Line 1,592:
assert(!"ABCDEFGHIJKL.NOPQRSTUVWXYZ".isPangram);
assert(!"ABCDEFGHIJKL.NOPQRSTUVWXYZ".isPangram);
assert("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ".isPangram);
assert("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ".isPangram);
}</lang>
}</syntaxhighlight>


===Unicode version===
===Unicode version===
<lang d>import std.string, std.traits, std.uni;
<syntaxhighlight lang="d">import std.string, std.traits, std.uni;


// Do not compile with -g (debug info).
// Do not compile with -g (debug info).
Line 1,382: Line 1,616:
assert(isPangram("Falsches Üben von Xylophonmusik quält jeden größeren Zwerg"d, Alphabet.DE));
assert(isPangram("Falsches Üben von Xylophonmusik quält jeden größeren Zwerg"d, Alphabet.DE));
assert(isPangram("Yxskaftbud, ge vår wczonmö iqhjälp"w, Alphabet.SV));
assert(isPangram("Yxskaftbud, ge vår wczonmö iqhjälp"w, Alphabet.SV));
}</lang>
}</syntaxhighlight>


=={{header|Delphi}}==
=={{header|Delphi}}==
<lang Delphi>program PangramChecker;
<syntaxhighlight lang="delphi">program PangramChecker;


{$APPTYPE CONSOLE}
{$APPTYPE CONSOLE}
Line 1,405: Line 1,639:
Writeln(IsPangram('The quick brown fox jumps over the lazy dog')); // true
Writeln(IsPangram('The quick brown fox jumps over the lazy dog')); // true
Writeln(IsPangram('Not a panagram')); // false
Writeln(IsPangram('Not a panagram')); // false
end.</lang>
end.</syntaxhighlight>


=={{header|Draco}}==
=={{header|Draco}}==
<lang draco>proc nonrec pangram(*char s) bool:
<syntaxhighlight lang="draco">proc nonrec pangram(*char s) bool:
ulong letters;
ulong letters;
char c;
char c;
Line 1,414: Line 1,648:
byte A = pretend('a', byte);
byte A = pretend('a', byte);
byte Z = pretend('z', byte);
byte Z = pretend('z', byte);

letters := 0L0;
letters := 0L0;
while
while
Line 1,430: Line 1,664:


proc nonrec test(*char s) void:
proc nonrec test(*char s) void:
writeln("\"", s, "\": ",
writeln("\"", s, "\": ",
if pangram(s) then "yes" else "no" fi)
if pangram(s) then "yes" else "no" fi)
corp
corp
Line 1,438: Line 1,672:
test("The five boxing wizards jump quickly.");
test("The five boxing wizards jump quickly.");
test("Not a pangram")
test("Not a pangram")
corp</lang>
corp</syntaxhighlight>
{{out}}
{{out}}
<pre>"The quick brown fox jumps over the lazy dog.": yes
<pre>"The quick brown fox jumps over the lazy dog.": yes
Line 1,446: Line 1,680:
=={{header|E}}==
=={{header|E}}==


<lang e>def isPangram(sentence :String) {
<syntaxhighlight lang="e">def isPangram(sentence :String) {
return ("abcdefghijklmnopqrstuvwxyz".asSet() &! sentence.toLowerCase().asSet()).size() == 0
return ("abcdefghijklmnopqrstuvwxyz".asSet() &! sentence.toLowerCase().asSet()).size() == 0
}</lang>
}</syntaxhighlight>


<code>&amp;!</code> is the “but-not” or set difference operator.
<code>&amp;!</code> is the “but-not” or set difference operator.

=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
func pangr s$ .
len d[] 26
for c$ in strchars s$
c = strcode c$
if c >= 97 and c <= 122
c -= 32
.
if c >= 65 and c <= 91
d[c - 64] = 1
.
.
for h in d[]
s += h
.
return s
.
repeat
s$ = input
until s$ = ""
print s$
if pangr s$ = 26
print " --> pangram"
.
print ""
.
input_data
This is a test.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumped over the lazy dog.
QwErTyUiOpAsDfGhJkLzXcVbNm
</syntaxhighlight>


=={{header|EDSAC order code}}==
=={{header|EDSAC order code}}==
Line 1,457: Line 1,725:
it in a text file, making that file the active file, and clicking Reset.
it in a text file, making that file the active file, and clicking Reset.
The string must be terminated by a blank row of tape (represented by '.' in EdsacPC).
The string must be terminated by a blank row of tape (represented by '.' in EdsacPC).
<lang edsac>
<syntaxhighlight lang="edsac">
[Pangram checker for Rosetta Code.
[Pangram checker for Rosetta Code.
EDSAC program, Initial Orders 2.]
EDSAC program, Initial Orders 2.]
Line 1,590: Line 1,858:
P F [acc = 0 on entry]
P F [acc = 0 on entry]
THE!QUICK!BROWN!FOX!JUMPS!OVER!THE!LAZY!DOG.
THE!QUICK!BROWN!FOX!JUMPS!OVER!THE!LAZY!DOG.
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,597: Line 1,865:


=={{header|Elixir}}==
=={{header|Elixir}}==
<lang elixir>defmodule Pangram do
<syntaxhighlight lang="elixir">defmodule Pangram do
def checker(str) do
def checker(str) do
unused = Enum.to_list(?a..?z) -- to_char_list(String.downcase(str))
unused = Enum.to_list(?a..?z) -- to_char_list(String.downcase(str))
Line 1,607: Line 1,875:
IO.puts "#{Pangram.checker(text)}\t#{text}"
IO.puts "#{Pangram.checker(text)}\t#{text}"
text = (Enum.to_list(?A..?Z) -- 'Test') |> to_string
text = (Enum.to_list(?A..?Z) -- 'Test') |> to_string
IO.puts "#{Pangram.checker(text)}\t#{text}"</lang>
IO.puts "#{Pangram.checker(text)}\t#{text}"</syntaxhighlight>


{{out}}
{{out}}
Line 1,616: Line 1,884:


=={{header|Erlang}}==
=={{header|Erlang}}==
<lang Erlang>-module(pangram).
<syntaxhighlight lang="erlang">-module(pangram).
-export([is_pangram/1]).
-export([is_pangram/1]).


is_pangram(String) ->
is_pangram(String) ->
ordsets:is_subset(lists:seq($a, $z), ordsets:from_list(string:to_lower(String))).</lang>
ordsets:is_subset(lists:seq($a, $z), ordsets:from_list(string:to_lower(String))).</syntaxhighlight>


=={{header|Excel}}==
=={{header|Excel}}==
Line 1,630: Line 1,898:


{{works with|Office 265 Betas 2010}}
{{works with|Office 265 Betas 2010}}
<lang lisp>ISPANGRAM
<syntaxhighlight lang="lisp">ISPANGRAM
=LAMBDA(s,
=LAMBDA(s,
LET(
LET(
Line 1,642: Line 1,910:
)
)
)
)
)</lang>
)</syntaxhighlight>


And assuming that the name CHARS is also bound in the Name Manager
And assuming that the name CHARS is also bound in the Name Manager
Line 1,648: Line 1,916:
to the generic (String -> Array Char) lambda:
to the generic (String -> Array Char) lambda:


<lang lisp>CHARS
<syntaxhighlight lang="lisp">CHARS
=LAMBDA(s,
=LAMBDA(s,
MID(s, ROW(INDIRECT("1:" & LEN(s))), 1)
MID(s, ROW(INDIRECT("1:" & LEN(s))), 1)
)</lang>
)</syntaxhighlight>
{{Out}}
{{Out}}
{| class="wikitable"
{| class="wikitable"
|-
|-
|||style="text-align:right; font-family:serif; font-style:italic; font-size:120%;"|fx
|||style="text-align:right; font-family:serif; font-style:italic; font-size:120%;"|fx
! colspan="2" style="text-align:left; vertical-align: bottom; font-family:Arial, Helvetica, sans-serif !important;"|=ISPANGRAM(A2)
! colspan="2" style="text-align:left; vertical-align: bottom; font-family:Arial, Helvetica, sans-serif !important;"|=ISPANGRAM(A2)
|- style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff;"
|- style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff;"
|
|
| A
| A
| B
| B
|- style="text-align:left;"
|- style="text-align:left;"
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 1
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 1
| style="text-align:right; font-weight:bold" | Test strings
| style="text-align:right; font-weight:bold" | Test strings
| style="font-weight:bold" | Verdicts
| style="font-weight:bold" | Verdicts
|- style="text-align:right;"
|- style="text-align:right;"
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 2
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 2
| style="text-align:right;" | The quick brown fox jumps over the lazy dog
| style="text-align:right;" | The quick brown fox jumps over the lazy dog
| style="background-color:#cbcefb; text-align:left; " | TRUE
| style="background-color:#cbcefb; text-align:left; " | TRUE
|- style="text-align:right;"
|- style="text-align:right;"
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 3
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 3
| style="text-align:right;" | Is this a pangram
| style="text-align:right;" | Is this a pangram
| style="text-align:left; | FALSE
| style="text-align:left; | FALSE
|- style="text-align:right;"
|- style="text-align:right;"
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 4
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 4
| style="text-align:right;" | How vexingly quick daft zebras jump!
| style="text-align:right;" | How vexingly quick daft zebras jump!
| style="text-align:left;" | TRUE
| style="text-align:left;" | TRUE
|- style="text-align:right;"
|- style="text-align:right;"
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 5
| style="text-align:center; font-family:Arial, Helvetica, sans-serif !important; background-color:#000000; color:#ffffff" | 5
| style="text-align:right;" | The five boxing wizards jumped quickly.
| style="text-align:right;" | The five boxing wizards jumped quickly.
| style="text-align:left;| TRUE
| style="text-align:left;| TRUE
|}
|}
Line 1,686: Line 1,954:
=={{header|F Sharp|F#}}==
=={{header|F Sharp|F#}}==
If the difference between the set of letters in the alphabet and the set of letters in the given string (after conversion to lower case) is the empty set then every letter appears somewhere in the given string:
If the difference between the set of letters in the alphabet and the set of letters in the given string (after conversion to lower case) is the empty set then every letter appears somewhere in the given string:
<lang fsharp>let isPangram (str: string) = (set['a'..'z'] - set(str.ToLower())).IsEmpty</lang>
<syntaxhighlight lang="fsharp">let isPangram (str: string) = (set['a'..'z'] - set(str.ToLower())).IsEmpty</syntaxhighlight>


=={{header|Factor}}==
=={{header|Factor}}==
{{trans|E}}
{{trans|E}}
<lang factor>: pangram? ( str -- ? )
<syntaxhighlight lang="factor">: pangram? ( str -- ? )
[ "abcdefghijklmnopqrstuvwxyz" ] dip >lower diff length 0 = ;
[ "abcdefghijklmnopqrstuvwxyz" ] dip >lower diff length 0 = ;


"How razorback-jumping frogs can level six piqued gymnasts!" pangram? .</lang>
"How razorback-jumping frogs can level six piqued gymnasts!" pangram? .</syntaxhighlight>


=={{header|Forth}}==
=={{header|Forth}}==
<lang forth>: pangram? ( addr len -- ? )
<syntaxhighlight lang="forth">: pangram? ( addr len -- ? )
0 -rot bounds do
0 -rot bounds do
i c@ 32 or [char] a -
i c@ 32 or [char] a -
Line 1,705: Line 1,973:
1 26 lshift 1- = ;
1 26 lshift 1- = ;


s" The five boxing wizards jump quickly." pangram? . \ -1</lang>
s" The five boxing wizards jump quickly." pangram? . \ -1</syntaxhighlight>


=={{header|Fortran}}==
=={{header|Fortran}}==
{{works with|Fortran|90 and later}}
{{works with|Fortran|90 and later}}
<lang fortran>module pangram
<syntaxhighlight lang="fortran">module pangram


implicit none
implicit none
Line 1,756: Line 2,024:
end function is_pangram
end function is_pangram


end module pangram</lang>
end module pangram</syntaxhighlight>
Example:
Example:
<lang fortran>program test
<syntaxhighlight lang="fortran">program test


use pangram, only: is_pangram
use pangram, only: is_pangram
Line 1,772: Line 2,040:
write (*, '(l1)') is_pangram (string)
write (*, '(l1)') is_pangram (string)


end program test</lang>
end program test</syntaxhighlight>
{{out}}
{{out}}
<pre>This is a sentence.
<pre>This is a sentence.
Line 1,778: Line 2,046:
The five boxing wizards jumped quickly.
The five boxing wizards jumped quickly.
T</pre>
T</pre>

=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64

Function isPangram(s As Const String) As Boolean
Dim As Integer length = Len(s)
If length < 26 Then Return False
Dim p As String = LCase(s)
For i As Integer = 97 To 122
If Instr(p, Chr(i)) = 0 Then Return False
Next
Return True
End Function

Dim s(1 To 3) As String = _
{ _
"The quick brown fox jumps over the lazy dog", _
"abbdefghijklmnopqrstuVwxYz", _ '' no c!
"How vexingly quick daft zebras jump!" _
}

For i As Integer = 1 To 3:
Print "'"; s(i); "' is "; IIf(isPangram(s(i)), "a", "not a"); " pangram"
Print
Next

Print
Print "Press nay key to quit"
Sleep</lang>

{{out}}
<pre>
'The quick brown fox jumps over the lazy dog' is a pangram

'abbdefghijklmnopqrstuVwxYz' is not a pangram

'How vexingly quick daft zebras jump!' is a pangram
</pre>


=={{header|Frink}}==
=={{header|Frink}}==
<lang frink>s = "The quick brown fox jumps over the lazy dog."
<syntaxhighlight lang="frink">s = "The quick brown fox jumps over the lazy dog."
println["\"$s\" is" + (isPangram[s] ? "" : " not") + " a pangram."]
println["\"$s\" is" + (isPangram[s] ? "" : " not") + " a pangram."]


Line 1,829: Line 2,059:


return true
return true
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
"The quick brown fox jumps over the lazy dog." is a pangram.
"The quick brown fox jumps over the lazy dog." is a pangram.
</pre>
</pre>


=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"

local fn IsPangram( pangramString as CFStringRef ) as BOOL
NSUInteger i, count
BOOL result
CFStringRef lcPanStr = fn StringLowerCaseString( pangramString )
CFMutableSetRef mutSet = fn MutableSetWithCapacity( 0 )
count = len(lcPanStr)
for i = 0 to count - 1
if ( fn CharacterSetCharacterIsMember( fn CharacterSetLowercaseLetterSet, fn StringCharacterAtIndex( lcPanStr, i ) ) )
MutableSetAddObject( mutSet, fn StringWithFormat( @"%c", fn StringCharacterAtIndex( lcPanStr, i ) ) )
end if
next
if fn SetCount( mutSet ) >= 26 then result = YES else result = NO
end fn = result


CFStringRef testStr, trueStr, falseStr
CFArrayRef array

trueStr = @"Is a pangram"
falseStr = @"Not a pangram"

array = @[¬
@"My dog has fleas.",¬
@"The quick brown fox jumps over the lazy do.",¬
@"The quick brown fox jumped over the lazy dog.",¬
@"The quick brown fox jumps over the lazy dog.",¬
@"Jackdaws love my big sphinx of quartz.",¬
@"What's a jackdaw?",¬
@"Watch \"Jeopardy!\", Alex Trebek's fun TV quiz game.",¬
@"Pack my box with five dozen liquor jugs.",¬
@"This definitely is not a pangram.",¬
@"This is a random long sentence just for testing purposes."]

for testStr in array
if ( fn IsPangram( testStr ) )
NSLog( @"%13s : %@", fn StringUTF8String( trueStr ), testStr ) else NSLog( @"%s : %@", fn StringUTF8String( falseStr ), testStr )
end if
next

HandleEvents
</syntaxhighlight>
{{output}}
<pre>
Not a pangram : My dog has fleas.
Not a pangram : The quick brown fox jumps over the lazy do.
Not a pangram : The quick brown fox jumped over the lazy dog.
Is a pangram : The quick brown fox jumps over the lazy dog.
Is a pangram : Jackdaws love my big sphinx of quartz.
Not a pangram : What's a jackdaw?
Is a pangram : Watch "Jeopardy!", Alex Trebek's fun TV quiz game.
Is a pangram : Pack my box with five dozen liquor jugs.
Not a pangram : This definitely is not a pangram.
Not a pangram : This is a random long sentence just for testing purposes.
</pre>





=={{header|Fōrmulæ}}==
=={{header|Fōrmulæ}}==


{{FormulaeEntry|page=https://formulae.org/?script=examples/Pangram_checker}}
Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text. Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation &mdash;i.e. XML, JSON&mdash; they are intended for storage and transfer purposes more than visualization and edition.


'''Solution'''
Programs in Fōrmulæ are created/edited online in its [https://formulae.org website], However they run on execution servers. By default remote servers are used, but they are limited in memory and processing power, since they are intended for demonstration and casual use. A local server can be downloaded and installed, it has no limitations (it runs in your own computer). Because of that, example programs can be fully visualized and edited, but some of them will not run if they require a moderate or heavy computation/memory resources, and no local server is being used.


[[File:Fōrmulæ - Pangram checker 01.png]]
In '''[https://formulae.org/?example=Pangram_checker this]''' page you can see the program(s) related to this task and their results.

'''Test cases'''

[[File:Fōrmulæ - Pangram checker 02.png]]

[[File:Fōrmulæ - Pangram checker 03.png]]

[[File:Fōrmulæ - Pangram checker 04.png]]

[[File:Fōrmulæ - Pangram checker 05.png]]


=={{header|Go}}==
=={{header|Go}}==
<lang go>package main
<syntaxhighlight lang="go">package main


import "fmt"
import "fmt"
Line 1,880: Line 2,185:
}
}
return false
return false
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,890: Line 2,195:
=={{header|Haskell}}==
=={{header|Haskell}}==


<lang haskell>import Data.Char (toLower)
<syntaxhighlight lang="haskell">import Data.Char (toLower)
import Data.List ((\\))
import Data.List ((\\))


Line 1,896: Line 2,201:
pangram = null . (['a' .. 'z'] \\) . map toLower
pangram = null . (['a' .. 'z'] \\) . map toLower


main = print $ pangram "How razorback-jumping frogs can level six piqued gymnasts!"</lang>
main = print $ pangram "How razorback-jumping frogs can level six piqued gymnasts!"</syntaxhighlight>


=={{header|HicEst}}==
=={{header|HicEst}}==
<lang HicEst>PangramBrokenAt("This is a Pangram.") ! => 2 (b is missing)
<syntaxhighlight lang="hicest">PangramBrokenAt("This is a Pangram.") ! => 2 (b is missing)
PangramBrokenAt("The quick Brown Fox jumps over the Lazy Dog") ! => 0 (OK)
PangramBrokenAt("The quick Brown Fox jumps over the Lazy Dog") ! => 0 (OK)


Line 1,906: Line 2,211:
PangramBrokenAt = INDEX(Alfabet, string, 64)
PangramBrokenAt = INDEX(Alfabet, string, 64)
! option 64: verify = 1st letter of string not in Alfabet
! option 64: verify = 1st letter of string not in Alfabet
END</lang>
END</syntaxhighlight>


=={{header|Icon}} and {{header|Unicon}}==
=={{header|Icon}} and {{header|Unicon}}==
A panagram procedure:
A panagram procedure:
<lang Icon>procedure panagram(s) #: return s if s is a panagram and fail otherwise
<syntaxhighlight lang="icon">procedure panagram(s) #: return s if s is a panagram and fail otherwise
if (map(s) ** &lcase) === &lcase then return s
if (map(s) ** &lcase) === &lcase then return s
end</lang>
end</syntaxhighlight>


And a main to drive it:
And a main to drive it:
<lang Icon>procedure main(arglist)
<syntaxhighlight lang="icon">procedure main(arglist)


if *arglist > 0 then
if *arglist > 0 then
every ( s := "" ) ||:= !arglist || " "
every ( s := "" ) ||:= !arglist || " "
else
else
s := "The quick brown fox jumps over the lazy dog."
s := "The quick brown fox jumps over the lazy dog."


writes(image(s), " -- is")
writes(image(s), " -- is")
writes(if not panagram(s) then "n't")
writes(if not panagram(s) then "n't")
write(" a panagram.")
write(" a panagram.")
end</lang>
end</syntaxhighlight>

=={{Header|Insitux}}==

<syntaxhighlight lang="insitux">
(function pangram? sentence
(let prepped (-> sentence lower-case to-vec))
(all? prepped (map char-code (range 97 123))))

(pangram? "The five boxing wizards jump quickly.")
</syntaxhighlight>


=={{header|Io}}==
=={{header|Io}}==
<lang Io>Sequence isPangram := method(
<syntaxhighlight lang="io">Sequence isPangram := method(
letters := " " repeated(26)
letters := " " repeated(26)
ia := "a" at(0)
ia := "a" at(0)
Line 1,941: Line 2,256:
"The quick brown fox jumps over the lazy dog." isPangram println // --> true
"The quick brown fox jumps over the lazy dog." isPangram println // --> true
"The quick brown fox jumped over the lazy dog." isPangram println // --> false
"The quick brown fox jumped over the lazy dog." isPangram println // --> false
"ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ" isPangram println // --> true</lang>
"ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ" isPangram println // --> true</syntaxhighlight>


=={{header|Ioke}}==
=={{header|Ioke}}==
<lang ioke>Text isPangram? = method(
<syntaxhighlight lang="ioke">Text isPangram? = method(
letters = "abcdefghijklmnopqrstuvwxyz" chars
letters = "abcdefghijklmnopqrstuvwxyz" chars
text = self lower chars
text = self lower chars
letters map(x, text include?(x)) reduce(&&)
letters map(x, text include?(x)) reduce(&&)
)</lang>
)</syntaxhighlight>


Here is an example of it's use in the Ioke REPL:
Here is an example of it's use in the Ioke REPL:


<lang ioke>
<syntaxhighlight lang="ioke">
iik> "The quick brown fox jumps over the lazy dog" isPangram?
iik> "The quick brown fox jumps over the lazy dog" isPangram?
"The quick brown fox jumps over the lazy dog" isPangram?
"The quick brown fox jumps over the lazy dog" isPangram?
Line 1,959: Line 2,274:
iik> "The quick brown fox jumps over the" isPangram?
iik> "The quick brown fox jumps over the" isPangram?
"The quick brown fox jumps over the" isPangram?
"The quick brown fox jumps over the" isPangram?
+> false</lang>
+> false</syntaxhighlight>


=={{header|J}}==
=={{header|J}}==
'''Solution:'''
'''Solution:'''
<lang j>require 'strings'
<syntaxhighlight lang="j">require 'strings'
isPangram=: (a. {~ 97+i.26) */@e. tolower</lang>
isPangram=: (a. {~ 97+i.26) */@e. tolower</syntaxhighlight>


'''Example use:'''
'''Example use:'''
<lang j> isPangram 'The quick brown fox jumps over the lazy dog.'
<syntaxhighlight lang="j"> isPangram 'The quick brown fox jumps over the lazy dog.'
1
1
isPangram 'The quick brown fox falls over the lazy dog.'
isPangram 'The quick brown fox falls over the lazy dog.'
0</lang>
0</syntaxhighlight>


=={{header|Java}}==
=={{header|Java}}==
{{works with|Java|1.5+}}
{{works with|Java|1.5+}}
<lang java5>public class Pangram {
<syntaxhighlight lang="java5">public class Pangram {
public static boolean isPangram(String test){
public static boolean isPangram(String test){
for (char a = 'A'; a <= 'Z'; a++)
for (char a = 'A'; a <= 'Z'; a++)
Line 1,991: Line 2,306:
System.out.println(isPangram(""));//false
System.out.println(isPangram(""));//false
}
}
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>true
<pre>true
Line 2,005: Line 2,320:
====Iterative====
====Iterative====


<lang javascript>function isPangram(s) {
<syntaxhighlight lang="javascript">function isPangram(s) {
var letters = "zqxjkvbpygfwmucldrhsnioate"
var letters = "zqxjkvbpygfwmucldrhsnioate"
// sorted by frequency ascending (http://en.wikipedia.org/wiki/Letter_frequency)
// sorted by frequency ascending (http://en.wikipedia.org/wiki/Letter_frequency)
Line 2,015: Line 2,330:


console.log(isPangram("is this a pangram")) // false
console.log(isPangram("is this a pangram")) // false
console.log(isPangram("The quick brown fox jumps over the lazy dog")) // true</lang>
console.log(isPangram("The quick brown fox jumps over the lazy dog")) // true</syntaxhighlight>


===ES6===
===ES6===
====Functional====
====Functional====


<lang JavaScript>(() => {
<syntaxhighlight lang="javascript">(() => {
"use strict";
"use strict";


Line 2,037: Line 2,352:
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
].map(isPangram);
].map(isPangram);
})();</lang>
})();</syntaxhighlight>


{{Out}}
{{Out}}
Line 2,043: Line 2,358:


=={{header|jq}}==
=={{header|jq}}==
<lang jq>def is_pangram:
<syntaxhighlight lang="jq">def is_pangram:
explode
explode
| map( if 65 <= . and . <= 90 then . + 32 # uppercase
| map( if 65 <= . and . <= 90 then . + 32 # uppercase
Line 2,053: Line 2,368:


# Example:
# Example:
"The quick brown fox jumps over the lazy dog" | is_pangram</lang>
"The quick brown fox jumps over the lazy dog" | is_pangram</syntaxhighlight>
{{Out}}
{{Out}}
$ jq -M -n -f pangram.jq
$ jq -M -n -f pangram.jq
Line 2,060: Line 2,375:
=={{header|Julia}}==
=={{header|Julia}}==
<tt>makepangramchecker</tt> creates a function to test for pangramity based upon the contents of its input string, allowing one to create arbitrary pangram checkers.
<tt>makepangramchecker</tt> creates a function to test for pangramity based upon the contents of its input string, allowing one to create arbitrary pangram checkers.
<lang Julia>function makepangramchecker(alphabet)
<syntaxhighlight lang="julia">function makepangramchecker(alphabet)
alphabet = Set(uppercase.(alphabet))
alphabet = Set(uppercase.(alphabet))
function ispangram(s)
function ispangram(s)
Line 2,079: Line 2,394:
for s in tests
for s in tests
println("The sentence \"", s, "\" is ", is_english_pangram(s) ? "" : "not ", "a pangram.")
println("The sentence \"", s, "\" is ", is_english_pangram(s) ? "" : "not ", "a pangram.")
end</lang>
end</syntaxhighlight>


{{out}}
{{out}}
Line 2,091: Line 2,406:


=={{header|K}}==
=={{header|K}}==
{{works with|Kona}}
<lang k>lcase : _ci 97+!26
<syntaxhighlight lang="k">lcase : _ci 97+!26
ucase : _ci 65+!26
ucase : _ci 65+!26
tolower : {@[x;p;:;lcase@n@p:&26>n:ucase?/:x]}
tolower : {@[x;p;:;lcase@n@p:&26>n:ucase?/:x]}
panagram: {&/lcase _lin tolower x}</lang>
panagram: {&/lcase _lin tolower x}</syntaxhighlight>


Example:
Example:
<lang k> panagram "The quick brown fox jumps over the lazy dog"
<syntaxhighlight lang="k"> panagram "The quick brown fox jumps over the lazy dog"
1
1
panagram "Panagram test"
panagram "Panagram test"
0</lang>
0</syntaxhighlight>

{{works with|ngn/k}}
<syntaxhighlight lang=K>isPangram:0=#(`c$"a"+!26)^_:

isPangram"This is a test"
0
isPangram"The quick brown fox jumps over the lazy dog."
1</syntaxhighlight>


=={{header|Kotlin}}==
=={{header|Kotlin}}==
<lang scala>// version 1.0.6
<syntaxhighlight lang="scala">// version 1.0.6


fun isPangram(s: String): Boolean {
fun isPangram(s: String): Boolean {
Line 2,111: Line 2,435:
if (c !in t) return false
if (c !in t) return false
return true
return true
}
}


fun main(args: Array<String>) {
fun main(args: Array<String>) {
Line 2,120: Line 2,444:
"A very mad quack might jinx zippy fowls" // no 'b' now!
"A very mad quack might jinx zippy fowls" // no 'b' now!
)
)
for (candidate in candidates)
for (candidate in candidates)
println("'$candidate' is ${if (isPangram(candidate)) "a" else "not a"} pangram")
println("'$candidate' is ${if (isPangram(candidate)) "a" else "not a"} pangram")
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 2,133: Line 2,457:


=={{header|Ksh}}==
=={{header|Ksh}}==
<lang ksh>
<syntaxhighlight lang="ksh">
#!/bin/ksh
#!/bin/ksh


Line 2,175: Line 2,499:
fi
fi
done
done
</syntaxhighlight>
</lang>
{{out}}<pre>
{{out}}<pre>
Mr. Jock, TV quiz PhD., bags few lynx. <<< IS A PANGRAM.
Mr. Jock, TV quiz PhD., bags few lynx. <<< IS A PANGRAM.
A very mad quack might jinx zippy fowls. <<< Is not a pangram.
A very mad quack might jinx zippy fowls. <<< Is not a pangram.
</pre>
</pre>

=={{header|Liberty BASIC}}==
<lang lb>'Returns 0 if the string is NOT a pangram or >0 if it IS a pangram
string$ = "The quick brown fox jumps over the lazy dog."

Print isPangram(string$)

Function isPangram(string$)
string$ = Lower$(string$)
For i = Asc("a") To Asc("z")
isPangram = Instr(string$, chr$(i))
If isPangram = 0 Then Exit Function
Next i
End Function</lang>


=={{header|Logo}}==
=={{header|Logo}}==
<lang logo>to remove.all :s :set
<syntaxhighlight lang="logo">to remove.all :s :set
if empty? :s [output :set]
if empty? :s [output :set]
if word? :s [output remove.all butfirst :s remove first :s :set]
if word? :s [output remove.all butfirst :s remove first :s :set]
Line 2,205: Line 2,515:
end
end


show pangram? [The five boxing wizards jump quickly.] ; true</lang>
show pangram? [The five boxing wizards jump quickly.] ; true</syntaxhighlight>


=={{header|Lua}}==
=={{header|Lua}}==
<lang lua>require"lpeg"
<syntaxhighlight lang="lua">require"lpeg"
S, C = lpeg.S, lpeg.C
S, C = lpeg.S, lpeg.C
function ispangram(s)
function ispangram(s)
Line 2,216: Line 2,526:
print(ispangram"waltz, bad nymph, for quick jigs vex")
print(ispangram"waltz, bad nymph, for quick jigs vex")
print(ispangram"bobby")
print(ispangram"bobby")
print(ispangram"long sentence")</lang>
print(ispangram"long sentence")</syntaxhighlight>


=={{header|Maple}}==
=={{header|Maple}}==
<lang Maple>#Used built-in StringTools package
<syntaxhighlight lang="maple">#Used built-in StringTools package
is_pangram := proc(str)
is_pangram := proc(str)
local present := StringTools:-LowerCase~(select(StringTools:-HasAlpha, StringTools:-Explode(str)));
local present := StringTools:-LowerCase~(select(StringTools:-HasAlpha, StringTools:-Explode(str)));
Line 2,226: Line 2,536:
return evalb(present = alphabets);
return evalb(present = alphabets);
end proc;
end proc;
</syntaxhighlight>
</lang>
{{out|Usage}}
{{out|Usage}}
<lang>is_pangram("The quick brown fox jumps over the lazy dog.");
<syntaxhighlight lang="text">is_pangram("The quick brown fox jumps over the lazy dog.");
is_pangram("The 2 QUIck brown foxes jumped over the lazy DOG!!");
is_pangram("The 2 QUIck brown foxes jumped over the lazy DOG!!");
is_pangram(""The quick brown fox jumps over the lay dog.");</lang>
is_pangram(""The quick brown fox jumps over the lay dog.");</syntaxhighlight>
{{out|Output}}
{{out|Output}}
<pre>
<pre>
Line 2,239: Line 2,549:


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>pangramQ[msg_]:=Complement[CharacterRange["a", "z"], Characters[ToLowerCase[msg]]]=== {}</lang>
<syntaxhighlight lang="mathematica">pangramQ[msg_]:=Complement[CharacterRange["a", "z"], Characters[ToLowerCase[msg]]]=== {}</syntaxhighlight>
Usage:
Usage:
<pre>pangramQ["The quick brown fox jumps over the lazy dog."]
<pre>pangramQ["The quick brown fox jumps over the lazy dog."]
Line 2,245: Line 2,555:


Or a slightly more verbose version that outputs the missing characters if the string is not a pangram:
Or a slightly more verbose version that outputs the missing characters if the string is not a pangram:
<lang Mathematica>pangramQ[msg_] :=
<syntaxhighlight lang="mathematica">pangramQ[msg_] :=
Function[If[# === {}, Print["The string is a pangram!"],
Function[If[# === {}, Print["The string is a pangram!"],
Print["The string is not a pangram. It's missing the letters " <>
Print["The string is not a pangram. It's missing the letters " <>
ToString[#]]]][
ToString[#]]]][
Complement[CharacterRange["a", "z"], Characters[ToLowerCase[msg]]]]</lang>
Complement[CharacterRange["a", "z"], Characters[ToLowerCase[msg]]]]</syntaxhighlight>
Usage:
Usage:
<pre>pangramQ["The quick brown fox jumps over the lazy dog."]
<pre>pangramQ["The quick brown fox jumps over the lazy dog."]
Line 2,257: Line 2,567:


=={{header|MATLAB}}==
=={{header|MATLAB}}==
<lang MATLAB>function trueFalse = isPangram(string)
<syntaxhighlight lang="matlab">function trueFalse = isPangram(string)


%This works by histogramming the ascii character codes for lower case
%This works by histogramming the ascii character codes for lower case
Line 2,268: Line 2,578:
trueFalse = isempty(find( histc(lower(string),(97:122))==0,1 ));
trueFalse = isempty(find( histc(lower(string),(97:122))==0,1 ));


end</lang>
end</syntaxhighlight>


{{out}}
{{out}}
<lang MATLAB>isPangram('The quick brown fox jumps over the lazy dog.')
<syntaxhighlight lang="matlab">isPangram('The quick brown fox jumps over the lazy dog.')


ans =
ans =


1</lang>
1</syntaxhighlight>


=={{header|MATLAB}} / {{header|Octave}}==
=={{header|MATLAB}} / {{header|Octave}}==

<lang matlab>function trueFalse = isPangram(string)
<syntaxhighlight lang="matlab">function trueFalse = isPangram(string)
% X is a histogram of letters
% X is a histogram of letters
X = sparse(abs(lower(string)),1,1,128,1);
X = sparse(abs(lower(string)),1,1,128,1);
trueFalse = full(all(X('a':'z') > 0));
trueFalse = full(all(X('a':'z') > 0));
end</lang>
end</syntaxhighlight>


{{out}}
{{out}}
Line 2,292: Line 2,602:
=={{header|min}}==
=={{header|min}}==
{{works with|min|0.19.3}}
{{works with|min|0.19.3}}
<lang min>"abcdefghijklmnopqrstuvwxyz" "" split =alphabet
<syntaxhighlight lang="min">"abcdefghijklmnopqrstuvwxyz" "" split =alphabet
('alphabet dip lowercase (swap match) prepend all?) :pangram?
('alphabet dip lowercase (swap match) prepend all?) :pangram?


"The quick brown fox jumps over the lazy dog." pangram? puts</lang>
"The quick brown fox jumps over the lazy dog." pangram? puts</syntaxhighlight>


=={{header|MiniScript}}==
=={{header|MiniScript}}==
<lang MiniScript>sentences = ["The quick brown fox jumps over the lazy dog.",
<syntaxhighlight lang="miniscript">sentences = ["The quick brown fox jumps over the lazy dog.",
"Peter Piper picked a peck of pickled peppers.",
"Peter Piper picked a peck of pickled peppers.",
"Waltz job vexed quick frog nymphs."]
"Waltz job vexed quick frog nymphs."]

alphabet = "abcdefghijklmnopqrstuvwxyz"
alphabet = "abcdefghijklmnopqrstuvwxyz"

pangram = function (toCheck)
pangram = function (toCheck)
sentence = toCheck.lower
sentence = toCheck.lower
Line 2,312: Line 2,622:
return true
return true
end function
end function

for sentence in sentences
for sentence in sentences
if pangram(sentence) then
if pangram(sentence) then
print """" + sentence + """ is a Pangram"
print """" + sentence + """ is a Pangram"
else
else
print """" + sentence + """ is not a Pangram"
print """" + sentence + """ is not a Pangram"
end if
end if
end for</lang>
end for</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 2,329: Line 2,639:
=={{header|ML}}==
=={{header|ML}}==
==={{header|mLite}}===
==={{header|mLite}}===
<lang ocaml>fun to_locase s = implode ` map (c_downcase) ` explode s
<syntaxhighlight lang="ocaml">fun to_locase s = implode ` map (c_downcase) ` explode s


fun is_pangram
fun is_pangram
(h :: t, T) =
(h :: t, T) =
let
let
val flen = len (filter (fn c = c eql h) T)
val flen = len (filter (fn c = c eql h) T)
in
in
Line 2,341: Line 2,651:
is_pangram (t, T)
is_pangram (t, T)
end
end
| ([], T) = true
| ([], T) = true
| S = is_pangram (explode "abcdefghijklmnopqrstuvwxyz", explode ` to_locase S)
| S = is_pangram (explode "abcdefghijklmnopqrstuvwxyz", explode ` to_locase S)

fun is_pangram_i
fun is_pangram_i
(h :: t, T) =
(h :: t, T) =
let
let
val flen = len (filter (fn c = c eql h) T)
val flen = len (filter (fn c = c eql h) T)
in
in
Line 2,354: Line 2,664:
is_pangram (t, T)
is_pangram (t, T)
end
end
| ([], T) = true
| ([], T) = true
| (A,S) = is_pangram (explode A, explode ` to_locase S)
| (A,S) = is_pangram (explode A, explode ` to_locase S)


fun test (f, arg, res, ok, notok) = if (f arg eql res) then ("'" @ arg @ "' " @ ok) else ("'" @ arg @ "' " @ notok)
fun test (f, arg, res, ok, notok) = if (f arg eql res) then ("'" @ arg @ "' " @ ok) else ("'" @ arg @ "' " @ notok)
fun test2 (f, arg, res, ok, notok) = if (f arg eql res) then ("'" @ ref (arg,1) @ "' " @ ok) else ("'" @ ref (arg,1) @ "' " @ notok)
fun test2 (f, arg, res, ok, notok) = if (f arg eql res) then ("'" @ ref (arg,1) @ "' " @ ok) else ("'" @ ref (arg,1) @ "' " @ notok)

;
;
println ` test (is_pangram, "The quick brown fox jumps over the lazy dog", true, "is a pangram", "is not a pangram");
println ` test (is_pangram, "The quick brown fox jumps over the lazy dog", true, "is a pangram", "is not a pangram");
println ` test (is_pangram, "abcdefghijklopqrstuvwxyz", true, "is a pangram", "is not a pangram");
println ` test (is_pangram, "abcdefghijklopqrstuvwxyz", true, "is a pangram", "is not a pangram");
val SValphabet = "abcdefghijklmnopqrstuvwxyzåäö";
val SValphabet = "abcdefghijklmnopqrstuvwxyzåäö";
val SVsentence = "Yxskaftbud, ge vår wczonmö iq hjälp";
val SVsentence = "Yxskaftbud, ge vår wczonmö iq hjälp";
println ` test2 (is_pangram_i, (SValphabet, SVsentence), true, "is a Swedish pangram", "is not a Swedish pangram");
println ` test2 (is_pangram_i, (SValphabet, SVsentence), true, "is a Swedish pangram", "is not a Swedish pangram");
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>'The quick brown fox jumps over the lazy dog' is a pangram
<pre>'The quick brown fox jumps over the lazy dog' is a pangram
Line 2,374: Line 2,684:


=={{header|Modula-2}}==
=={{header|Modula-2}}==
<lang modula2>MODULE Pangrams;
<syntaxhighlight lang="modula2">MODULE Pangrams;
FROM InOut IMPORT WriteString, WriteLn;
FROM InOut IMPORT WriteString, WriteLn;
FROM Strings IMPORT Length;
FROM Strings IMPORT Length;
Line 2,415: Line 2,725:
example("The five boxing wizards dump quickly");
example("The five boxing wizards dump quickly");
example("abcdefghijklmnopqrstuvwxyz");
example("abcdefghijklmnopqrstuvwxyz");
END Pangrams.</lang>
END Pangrams.</syntaxhighlight>
{{out}}
{{out}}
<pre>'The quick brown fox jumps over the lazy dog' is a pangram.
<pre>'The quick brown fox jumps over the lazy dog' is a pangram.
Line 2,423: Line 2,733:
=={{header|NetRexx}}==
=={{header|NetRexx}}==
NetRexx's <code>verify</code> built&ndash;in method is all you need!
NetRexx's <code>verify</code> built&ndash;in method is all you need!
<lang NetRexx>/* NetRexx */
<syntaxhighlight lang="netrexx">/* NetRexx */
options replace format comments java crossref savelog symbols nobinary
options replace format comments java crossref savelog symbols nobinary


Line 2,452: Line 2,762:


return pangrams
return pangrams
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre style="overflow:scroll">
<pre style="overflow:scroll">
Line 2,463: Line 2,773:


=={{header|NewLISP}}==
=={{header|NewLISP}}==
<lang newlisp>
<syntaxhighlight lang="newlisp">
(context 'PGR) ;; Switch to context (say namespace) PGR
(context 'PGR) ;; Switch to context (say namespace) PGR
(define (is-pangram? str)
(define (is-pangram? str)
Line 2,482: Line 2,792:
(println (PGR:is-pangram? "abcdef")) ;; Print nil
(println (PGR:is-pangram? "abcdef")) ;; Print nil
(exit)
(exit)
</syntaxhighlight>
</lang>


=={{header|Nim}}==
=={{header|Nim}}==
<lang nim>import rdstdin
<syntaxhighlight lang="nim">import rdstdin


proc isPangram(sentence: string, alphabet = {'a'..'z'}): bool =
proc isPangram(sentence: string, alphabet = {'a'..'z'}): bool =
Line 2,492: Line 2,802:
alphabet <= sentset
alphabet <= sentset


echo isPangram(readLineFromStdin "Sentence: ")</lang>
echo isPangram(readLineFromStdin "Sentence: ")</syntaxhighlight>
Example usage:
Example usage:
<pre>Sentence: The quick brown fox jumps over the lazy dog
<pre>Sentence: The quick brown fox jumps over the lazy dog
Line 2,499: Line 2,809:
=={{header|Objeck}}==
=={{header|Objeck}}==
{{trans|Java}}
{{trans|Java}}
<lang objeck>
<syntaxhighlight lang="objeck">
bundle Default {
bundle Default {
class Pangram {
class Pangram {
Line 2,523: Line 2,833:
}
}
}
}
</syntaxhighlight>
</lang>


=={{header|OCaml}}==
=={{header|OCaml}}==


<lang ocaml>let pangram str =
<syntaxhighlight lang="ocaml">let pangram str =
let ar = Array.make 26 false in
let ar = Array.make 26 false in
String.iter (function
String.iter (function
Line 2,533: Line 2,843:
| _ -> ()
| _ -> ()
) (String.lowercase str);
) (String.lowercase str);
Array.fold_left ( && ) true ar</lang>
Array.fold_left ( && ) true ar</syntaxhighlight>


<lang ocaml>let check str =
<syntaxhighlight lang="ocaml">let check str =
Printf.printf " %b -- %s\n" (pangram str) str
Printf.printf " %b -- %s\n" (pangram str) str


Line 2,541: Line 2,851:
check "this is a sentence";
check "this is a sentence";
check "The quick brown fox jumps over the lazy dog.";
check "The quick brown fox jumps over the lazy dog.";
;;</lang>
;;</syntaxhighlight>


{{out}}
{{out}}
Line 2,548: Line 2,858:


=={{header|Oz}}==
=={{header|Oz}}==
<lang oz>declare
<syntaxhighlight lang="oz">declare
fun {IsPangram Xs}
fun {IsPangram Xs}
{List.sub
{List.sub
Line 2,555: Line 2,865:
end
end
in
in
{Show {IsPangram "The quick brown fox jumps over the lazy dog."}}</lang>
{Show {IsPangram "The quick brown fox jumps over the lazy dog."}}</syntaxhighlight>


=={{header|PARI/GP}}==
=={{header|PARI/GP}}==
<lang parigp>pangram(s)={
<syntaxhighlight lang="parigp">pangram(s)={
s=vecsort(Vec(s),,8);
s=vecsort(Vec(s),,8);
for(i=97,122,
for(i=97,122,
Line 2,569: Line 2,879:


pangram("The quick brown fox jumps over the lazy dog.")
pangram("The quick brown fox jumps over the lazy dog.")
pangram("The quick brown fox jumps over the lazy doe.")</lang>
pangram("The quick brown fox jumps over the lazy doe.")</syntaxhighlight>


=={{header|Pascal}}==
=={{header|Pascal}}==
Line 2,576: Line 2,886:
=={{header|Perl}}==
=={{header|Perl}}==
Get an answer with a module, or without.
Get an answer with a module, or without.
<lang perl>use strict;
<syntaxhighlight lang="perl">use strict;
use warnings;
use warnings;
use feature 'say';
use feature 'say';
Line 2,599: Line 2,909:
say pangram1($_,@alpha) ? 'Yes' : 'No';
say pangram1($_,@alpha) ? 'Yes' : 'No';
say pangram2($_,@alpha) ? 'Yes' : 'No';
say pangram2($_,@alpha) ? 'Yes' : 'No';
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Yes
<pre>Yes
Line 2,607: Line 2,917:


=={{header|Phix}}==
=={{header|Phix}}==
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">function</span> <span style="color: #000000;">pangram</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">pangram</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">az</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #004600;">false</span><span style="color: #0000FF;">,</span><span style="color: #000000;">26</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">az</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #004600;">false</span><span style="color: #0000FF;">,</span><span style="color: #000000;">26</span><span style="color: #0000FF;">)</span>
Line 2,623: Line 2,933:
<span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #004600;">false</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #004600;">false</span><span style="color: #0000FF;">,</span><span style="color: #000000;">az</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">96</span><span style="color: #0000FF;">}</span>
<span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #004600;">false</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #004600;">false</span><span style="color: #0000FF;">,</span><span style="color: #000000;">az</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">96</span><span style="color: #0000FF;">}</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>

<span style="color: #004080;">sequence</span> <span style="color: #000000;">checks</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">"The quick brown fox jumped over the lazy dog"</span><span style="color: #0000FF;">,</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">checks</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span><span style="color: #008000;">"The quick brown fox jumped over the lazy dog"</span><span style="color: #0000FF;">,</span>
<span style="color: #008000;">"The quick brown fox jumps over the lazy dog"</span><span style="color: #0000FF;">,</span>
<span style="color: #008000;">"The quick brown fox jumps over the lazy dog"</span><span style="color: #0000FF;">,</span>
Line 2,639: Line 2,949:
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%-50s - %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">ci</span><span style="color: #0000FF;">,</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #000000;">r</span><span style="color: #0000FF;">?</span><span style="color: #008000;">"yes"</span><span style="color: #0000FF;">:</span><span style="color: #008000;">"no "</span><span style="color: #0000FF;">&</span><span style="color: #000000;">ch</span><span style="color: #0000FF;">)})</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%-50s - %s\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">ci</span><span style="color: #0000FF;">,</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #000000;">r</span><span style="color: #0000FF;">?</span><span style="color: #008000;">"yes"</span><span style="color: #0000FF;">:</span><span style="color: #008000;">"no "</span><span style="color: #0000FF;">&</span><span style="color: #000000;">ch</span><span style="color: #0000FF;">)})</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
{{out}}
{{out}}
<pre>
<pre>
Line 2,653: Line 2,963:
no - no a
no - no a
</pre>
</pre>

=={{header|Phixmonti}}==
<syntaxhighlight lang="Phixmonti">include ..\Utilitys.pmt

def pangram?
lower "abcdefghijklmnopqrstuvwxyz" swap remove len not nip
enddef

"The quick brown fox jumps over the lazy dog." pangram?
"This is a test" pangram?
"NOPQRSTUVWXYZ abcdefghijklm" pangram?
"abcdefghijklopqrstuvwxyz" pangram?

pstack</syntaxhighlight>
{{out}}
<pre>
[1, 0, 1, 0]

=== Press any key to exit ===</pre>


=={{header|PHP}}==
=={{header|PHP}}==
{{trans|D}}
{{trans|D}}
<lang php>function isPangram($text) {
<syntaxhighlight lang="php">function isPangram($text) {
foreach (str_split($text) as $c) {
foreach (str_split($text) as $c) {
if ($c >= 'a' && $c <= 'z')
if ($c >= 'a' && $c <= 'z')
Line 2,675: Line 3,004:


foreach ($test as $str)
foreach ($test as $str)
echo "$str : ", isPangram($str) ? 'T' : 'F', '</br>';</lang>
echo "$str : ", isPangram($str) ? 'T' : 'F', '</br>';</syntaxhighlight>


<pre>the quick brown fox jumps over the lazy dog : T
<pre>the quick brown fox jumps over the lazy dog : T
Line 2,685: Line 3,014:


Using array
Using array
<lang php>function is_pangram( $sentence ) {
<syntaxhighlight lang="php">function is_pangram( $sentence ) {


// define "alphabet"
// define "alphabet"
Line 2,712: Line 3,041:
echo is_pangram( $txt ) ? "Yes" : "No", PHP_EOL, PHP_EOL;
echo is_pangram( $txt ) ? "Yes" : "No", PHP_EOL, PHP_EOL;
}
}
</syntaxhighlight>
</lang>


{{Out}}
{{Out}}
Line 2,740: Line 3,069:


=={{header|Picat}}==
=={{header|Picat}}==
<lang Picat>go =>
<syntaxhighlight lang="picat">go =>
S1 = "The quick brown fox jumps over the lazy dog",
S1 = "The quick brown fox jumps over the lazy dog",
S2 = "The slow brown fox jumps over the lazy dog",
S2 = "The slow brown fox jumps over the lazy dog",
println([S1, is_pangram(S1)]),
println([S1, is_pangram(S1)]),
println([S2, is_pangram(S2)]),
println([S2, is_pangram(S2)]),
Line 2,760: Line 3,089:
is_pangram2(S) = [pangram=cond(Missing==[],true,false),missing=Missing] =>
is_pangram2(S) = [pangram=cond(Missing==[],true,false),missing=Missing] =>
Lower = S.to_lowercase,
Lower = S.to_lowercase,
Missing = [A : A in [chr(I+96) : I in 1..26], not membchk(A,Lower)].</lang>
Missing = [A : A in [chr(I+96) : I in 1..26], not membchk(A,Lower)].</syntaxhighlight>


{{out}}
{{out}}
Line 2,771: Line 3,100:


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==
<lang PicoLisp>(de isPangram (Str)
<syntaxhighlight lang="picolisp">(de isPangram (Str)
(not
(not
(diff
(diff
'`(chop "abcdefghijklmnopqrstuvwxyz")
'`(chop "abcdefghijklmnopqrstuvwxyz")
(chop (lowc Str)) ) ) )</lang>
(chop (lowc Str)) ) ) )</syntaxhighlight>


=={{header|PL/I}}==
=={{header|PL/I}}==
<syntaxhighlight lang="pl/i">
<lang PL/I>
test_pangram: procedure options (main);
test_pangram: procedure options (main);


Line 2,807: Line 3,136:


end test_pangram;
end test_pangram;
</syntaxhighlight>
</lang>


{{out}}
{{out}}
<pre>
<pre>
Please type a sentence
Please type a sentence


the quick brown fox jumps over the lazy dog
the quick brown fox jumps over the lazy dog
The sentence is a pangram.
The sentence is a pangram.
</pre>
</pre>


Line 2,820: Line 3,149:
Cyrillic test sample borrowed from Raku.
Cyrillic test sample borrowed from Raku.
{{works with|PowerShell|2}}
{{works with|PowerShell|2}}
<syntaxhighlight lang="powershell">
<lang PowerShell>
function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
{
{
$Text = $Text.ToLower()
$Text = $Text.ToLower()
$Alphabet = $Alphabet.ToLower()
$Alphabet = $Alphabet.ToLower()

$IsPangram = @( $Alphabet.ToCharArray() | Where-Object { $Text.Contains( $_ ) } ).Count -eq $Alphabet.Length
$IsPangram = @( $Alphabet.ToCharArray() | Where-Object { $Text.Contains( $_ ) } ).Count -eq $Alphabet.Length

return $IsPangram
return $IsPangram
}
}

Test-Pangram 'The quick brown fox jumped over the lazy dog.'
Test-Pangram 'The quick brown fox jumped over the lazy dog.'
Test-Pangram 'The quick brown fox jumps over the lazy dog.'
Test-Pangram 'The quick brown fox jumps over the lazy dog.'
Test-Pangram 'Съешь же ещё этих мягких французских булок, да выпей чаю' 'абвгдежзийклмнопрстуфхцчшщъыьэюяё'
Test-Pangram 'Съешь же ещё этих мягких французских булок, да выпей чаю' 'абвгдежзийклмнопрстуфхцчшщъыьэюяё'
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 2,842: Line 3,171:
</pre>
</pre>
A faster version can be created using .Net HashSet to do what the F# version does:
A faster version can be created using .Net HashSet to do what the F# version does:
<syntaxhighlight lang="powershell">
<lang PowerShell>
Function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
Function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
{
{
Line 2,852: Line 3,181:
return $alSet.Count -eq 0 # any alphabet letters still remaining?
return $alSet.Count -eq 0 # any alphabet letters still remaining?
}
}
</syntaxhighlight>
</lang>


=={{header|Prolog}}==
=={{header|Prolog}}==
Works with SWI-Prolog
Works with SWI-Prolog


<lang Prolog>pangram(L) :-
<syntaxhighlight lang="prolog">pangram(L) :-
numlist(0'a, 0'z, Alphabet),
numlist(0'a, 0'z, Alphabet),
forall(member(C, Alphabet), member(C, L)).
forall(member(C, Alphabet), member(C, L)).
Line 2,869: Line 3,198:
( pangram(L2) -> R2 = ok; R2 = ko),
( pangram(L2) -> R2 = ok; R2 = ko),
format('~s --> ~w ~n', [L2, R2]).
format('~s --> ~w ~n', [L2, R2]).
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>?- pangram_example.
<pre>?- pangram_example.
the quick brown fox jumps over the lazy dog --> ok
the quick brown fox jumps over the lazy dog --> ok
the quick brown fox jumped over the lazy dog --> ko
the quick brown fox jumped over the lazy dog --> ko
true.</pre>
true.</pre>

=={{header|PureBasic}}==
<lang PureBasic>Procedure IsPangram_fast(String$)
String$ = LCase(string$)
char_a=Asc("a")
; sets bits in a variable if a letter is found, reads string only once
For a = 1 To Len(string$)
char$ = Mid(String$, a, 1)
pos = Asc(char$) - char_a
check.l | 1 << pos
Next
If check & $3FFFFFF = $3FFFFFF
ProcedureReturn 1
EndIf
ProcedureReturn 0
EndProcedure

Procedure IsPangram_simple(String$)
String$ = LCase(string$)
found = 1
For a = Asc("a") To Asc("z")
; searches for every letter in whole string
If FindString(String$, Chr(a), 0) = 0
found = 0
EndIf
Next
ProcedureReturn found
EndProcedure

Debug IsPangram_fast("The quick brown fox jumps over lazy dogs.")
Debug IsPangram_simple("The quick brown fox jumps over lazy dogs.")
Debug IsPangram_fast("No pangram")
Debug IsPangram_simple("No pangram")</lang>


=={{header|Python}}==
=={{header|Python}}==
Using set arithmetic:
Using set arithmetic:
<lang python>import string, sys
<syntaxhighlight lang="python">import string, sys
if sys.version_info[0] < 3:
if sys.version_info[0] < 3:
input = raw_input
input = raw_input
Line 2,919: Line 3,215:
return alphaset <= set(sentence.lower())
return alphaset <= set(sentence.lower())


print ( ispangram(input('Sentence: ')) )</lang>
print ( ispangram(input('Sentence: ')) )</syntaxhighlight>


{{out}}
{{out}}
Line 2,926: Line 3,222:


=={{header|Quackery}}==
=={{header|Quackery}}==
<lang quackery>
<syntaxhighlight lang="quackery">
[ dup char A char [ within
[ dup char A char [ within
swap char a char { within
swap char a char { within
Line 2,940: Line 3,236:
$ "This is a sentence." pangram echo cr ( 0 )
$ "This is a sentence." pangram echo cr ( 0 )
$ "The five boxing wizards jumped quickly." pangram echo cr ( 1 )
$ "The five boxing wizards jumped quickly." pangram echo cr ( 1 )
</syntaxhighlight>
</lang>


=={{header|R}}==
=={{header|R}}==
Using the built-in R vector "letters":
Using the built-in R vector "letters":
<lang R>checkPangram <- function(sentence){
<syntaxhighlight lang="r">checkPangram <- function(sentence){
my.letters <- tolower(unlist(strsplit(sentence, "")))
my.letters <- tolower(unlist(strsplit(sentence, "")))
is.pangram <- all(letters %in% my.letters)
is.pangram <- all(letters %in% my.letters)

if (is.pangram){
if (is.pangram){
cat("\"", sentence, "\" is a pangram! \n", sep="")
cat("\"", sentence, "\" is a pangram! \n", sep="")
Line 2,954: Line 3,250:
}
}
}
}
</lang>
</syntaxhighlight>


{{out}}
{{out}}
Line 2,967: Line 3,263:
=={{header|Racket}}==
=={{header|Racket}}==


<syntaxhighlight lang="racket">
<lang Racket>
#lang racket
#lang racket
(define (pangram? str)
(define (pangram? str)
Line 2,973: Line 3,269:
(= 26 (length (remove-duplicates (string->list chars)))))
(= 26 (length (remove-duplicates (string->list chars)))))
(pangram? "The quick Brown Fox jumps over the Lazy Dog")
(pangram? "The quick Brown Fox jumps over the Lazy Dog")
</syntaxhighlight>
</lang>


=={{header|Raku}}==
=={{header|Raku}}==
(formerly Perl 6)
(formerly Perl 6)
<lang perl6>constant Eng = set 'a' .. 'z';
<syntaxhighlight lang="raku" line>constant Eng = set 'a' .. 'z';
constant Cyr = (set 'а' .. 'ё') (-) (set 'ъ', 'ѐ')
constant Cyr = (set 'а' .. 'ё') (-) (set 'ъ', 'ѐ');
constant Hex = set 'a' .. 'f';
constant Hex = set 'a' .. 'f';


sub pangram($str, Set $alpha = Eng) {
sub pangram($str, Set $alpha = Eng) {
$alpha ⊆ $str.lc.comb;
$alpha ⊆ $str.lc.comb
}
}


Line 2,989: Line 3,285:
say pangram("My dog has fleas.", Hex);
say pangram("My dog has fleas.", Hex);
say pangram("My dog backs fleas.", Hex);
say pangram("My dog backs fleas.", Hex);
say pangram "Съешь же ещё этих мягких французских булок, да выпей чаю", Cyr;</lang>
say pangram "Съешь же ещё этих мягких французских булок, да выпей чаю", Cyr;</syntaxhighlight>
{{out}}
{{out}}
<pre>True
<pre>True
Line 2,998: Line 3,294:


=={{header|Retro}}==
=={{header|Retro}}==
<lang Retro>'abcdefghijklmnopqrstuvwxyz 'FULL s:const
<syntaxhighlight lang="retro">'abcdefghijklmnopqrstuvwxyz 'FULL s:const
'__________________________ 'TEST s:const
'__________________________ 'TEST s:const
:s:pangram? (s-f)
:s:pangram? (s-f)
Line 3,005: Line 3,301:
[ dup $a - &TEST + store ] s:for-each
[ dup $a - &TEST + store ] s:for-each
&TEST &FULL s:eq? ;
&TEST &FULL s:eq? ;
</syntaxhighlight>
</lang>


=={{header|REXX}}==
=={{header|REXX}}==
<lang REXX>/*REXX program verifies if an entered/supplied string (sentence) is a pangram. */
<syntaxhighlight lang="rexx">/*REXX program verifies if an entered/supplied string (sentence) is a pangram. */
@abc= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /*a list of all (Latin) capital letters*/
@abc= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /*a list of all (Latin) capital letters*/


Line 3,021: Line 3,317:
end /*forever*/
end /*forever*/


say '──────── PANGRAM program ended. ────────' /*stick a fork in it, we're all done. */</lang>
say '──────── PANGRAM program ended. ────────' /*stick a fork in it, we're all done. */</syntaxhighlight>
{{out|output|:}}
{{out|output|:}}
<pre>
<pre>
Line 3,035: Line 3,331:


──────── Please enter a pangramic sentence (or a blank to quit):
──────── Please enter a pangramic sentence (or a blank to quit):
◄■■■■■■■■■■ user input (null or some blanks).
◄■■■■■■■■■■ user input (null or some blanks).


──────── PANGRAM program ended. ────────
──────── PANGRAM program ended. ────────
Line 3,041: Line 3,337:


=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>
<syntaxhighlight lang="ring">
pangram = 0
pangram = 0
s = "The quick brown fox jumps over the lazy dog."
s = "The quick brown fox jumps over the lazy dog."
see "" + pangram(s) + " " + s + nl
see "" + pangram(s) + " " + s + nl

s = "My dog has fleas."
s = "My dog has fleas."
see "" + pangram(s) + " " + s + nl
see "" + pangram(s) + " " + s + nl

func pangram str
func pangram str
str = lower(str)
str = lower(str)
Line 3,054: Line 3,350:
bool = substr(str, char(i)) > 0
bool = substr(str, char(i)) > 0
pangram = pangram + bool
pangram = pangram + bool
next
next
pan = (pangram = 26)
pan = (pangram = 26)
return pan
return pan
</syntaxhighlight>
</lang>

=={{header|RPL}}==
====Structurally programmed====
{| class="wikitable" ≪
! RPL code
! Comment
|-
|
# 0h SWAP 1 OVER SIZE '''FOR''' j
DUP j DUP SUB NUM
'''IF''' DUP 97 ≥ OVER 122 ≤ AND '''THEN''' 32 - '''END'''
'''IF''' DUP 65 ≥ OVER 90 ≤ AND '''THEN'''
2 SWAP 65 - ^ R→B ROT OR SWAP
'''ELSE''' DROP '''END'''
'''NEXT''' DROP # 3FFFFFFh ==
≫ ‘<span style="color:blue">PANG?</span>’ STO
|
<span style="color:blue">PANG?</span> ''( "sentence" → boolean ) ''
alpha = 0; loop for j = 1 to length(sentence)
c = ascii(sentence[j])
if c lowercase then make it uppercase
if c in ("A".."Z") then
alpha &= 2^(c-65)
end loop
return alpha & 3FFFFFFh
|}
====Idiomatically optimized for HP-28S====
{| class="wikitable" ≪
! RPL code
! Comment
|-
|
# 7FFFFFEh RCLF OVER NOT AND STOF SWAP
1 OVER SIZE '''FOR''' j
DUP j DUP SUB NUM
DUP 97 ≥ 95 63 IFTE - 1 MAX 28 MIN SF
'''NEXT''' DROP RCLF OVER AND ==
≫ ‘<span style="color:blue">PANG?</span>’ STO
|
<span style="color:blue">PANG?</span> ''( "sentence" → boolean ) ''
clear flags 1 to 28
loop for j = 1 to length(sentence)
c = ascii(sentence[j])
reduce c to a value between 1 and 28 and set related flag
return 1 if all flags between 2 and 27 are set
|}
To run on more recent models, the following sequence in line 2
RCLF OVER NOT AND STOF
must be replaced by
RCLF DUP 2 GET 3 PICK NOT AND 2 SWAP PUT STOF
and <code>RCLF</code> in the last line by <code>RCLF 2 GET</code>.
"The quick brown fox jumps over the lazy dog" <span style="color:blue">PANG?</span>
"The quick brown fox jumped over the lazy dog" <span style="color:blue">PANG?</span>
{{out}}
<pre>
2: 1
1: 0
</pre>


=={{header|Ruby}}==
=={{header|Ruby}}==
<lang ruby>def pangram?(sentence)
<syntaxhighlight lang="ruby">def pangram?(sentence)
s = sentence.downcase
s = sentence.downcase
('a'..'z').all? {|char| s.include? (char) }
('a'..'z').all? {|char| s.include? (char) }
Line 3,066: Line 3,424:


p pangram?('this is a sentence') # ==> false
p pangram?('this is a sentence') # ==> false
p pangram?('The quick brown fox jumps over the lazy dog.') # ==> true</lang>
p pangram?('The quick brown fox jumps over the lazy dog.') # ==> true</syntaxhighlight>

=={{header|Run BASIC}}==
<lang runbasic>s$ = "The quick brown fox jumps over the lazy dog."
Print pangram(s$);" ";s$

s$ = "My dog has fleas."
Print pangram(s$);" ";s$
function pangram(str$)
str$ = lower$(str$)
for i = asc("a") to asc("z")
pangram = pangram + (instr(str$, chr$(i)) <> 0)
next i
pangram = (pangram = 26)
end function</lang><pre>1 The quick brown fox jumps over the lazy dog.
0 My dog has fleas.</pre>


=={{header|Rust}}==
=={{header|Rust}}==
<lang rust>#![feature(test)]
<syntaxhighlight lang="rust">#![feature(test)]


extern crate test;
extern crate test;
Line 3,153: Line 3,495:
is_pangram_hashset);
is_pangram_hashset);
}
}
}</lang>
}</syntaxhighlight>


=={{header|Scala}}==
=={{header|Scala}}==
<lang scala>def is_pangram(sentence: String) = sentence.toLowerCase.filter(c => c >= 'a' && c <= 'z').toSet.size == 26
<syntaxhighlight lang="scala">def is_pangram(sentence: String) = sentence.toLowerCase.filter(c => c >= 'a' && c <= 'z').toSet.size == 26
</syntaxhighlight>
</lang>


<lang scala>
<syntaxhighlight lang="scala">
scala> is_pangram("This is a sentence")
scala> is_pangram("This is a sentence")
res0: Boolean = false
res0: Boolean = false
Line 3,165: Line 3,507:
scala> is_pangram("The quick brown fox jumps over the lazy dog")
scala> is_pangram("The quick brown fox jumps over the lazy dog")
res1: Boolean = true
res1: Boolean = true
</syntaxhighlight>
</lang>


=={{header|Seed7}}==
=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i";


const func boolean: isPangram (in string: stri) is func
const func boolean: isPangram (in string: stri) is func
Line 3,191: Line 3,533:
writeln(isPangram("NOPQRSTUVWXYZ abcdefghijklm"));
writeln(isPangram("NOPQRSTUVWXYZ abcdefghijklm"));
writeln(isPangram("abcdefghijklopqrstuvwxyz")); # Missing m, n
writeln(isPangram("abcdefghijklopqrstuvwxyz")); # Missing m, n
end func;</lang>
end func;</syntaxhighlight>


{{out}}
{{out}}
Line 3,203: Line 3,545:
=={{header|Sidef}}==
=={{header|Sidef}}==
{{trans|Raku}}
{{trans|Raku}}
<lang ruby>define Eng = 'a'..'z';
<syntaxhighlight lang="ruby">define Eng = 'a'..'z';
define Hex = 'a'..'f';
define Hex = 'a'..'f';
define Cyr = %w(а б в г д е ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я ё);
define Cyr = %w(а б в г д е ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я ё);
Line 3,216: Line 3,558:
say pangram("My dog has fleas.", Hex);
say pangram("My dog has fleas.", Hex);
say pangram("My dog backs fleas.", Hex);
say pangram("My dog backs fleas.", Hex);
say pangram("Съешь же ещё этих мягких французских булок, да выпей чаю", Cyr);</lang>
say pangram("Съешь же ещё этих мягких французских булок, да выпей чаю", Cyr);</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 3,227: Line 3,569:


=={{header|Smalltalk}}==
=={{header|Smalltalk}}==
<lang smalltalk>!String methodsFor: 'testing'!
<syntaxhighlight lang="smalltalk">!String methodsFor: 'testing'!
isPangram
isPangram
^((self collect: [:c | c asUppercase]) select: [:c | c >= $A and: [c <= $Z]]) asSet size = 26
^((self collect: [:c | c asUppercase]) select: [:c | c >= $A and: [c <= $Z]]) asSet size = 26
</syntaxhighlight>
</lang>


<lang smalltalk>
<syntaxhighlight lang="smalltalk">
'The quick brown fox jumps over the lazy dog.' isPangram
'The quick brown fox jumps over the lazy dog.' isPangram
</syntaxhighlight>
</lang>


=={{header|SNOBOL4}}==
=={{header|SNOBOL4}}==
Line 3,242: Line 3,584:
{{works with|CSnobol}}
{{works with|CSnobol}}


<lang SNOBOL4> define('pangram(str)alfa,c') :(pangram_end)
<syntaxhighlight lang="snobol4"> define('pangram(str)alfa,c') :(pangram_end)
pangram str = replace(str,&ucase,&lcase)
pangram str = replace(str,&ucase,&lcase)
alfa = &lcase
alfa = &lcase
Line 3,250: Line 3,592:


define('panchk(str)tf') :(panchk_end)
define('panchk(str)tf') :(panchk_end)
panchk output = str
panchk output = str
tf = 'False'; tf = pangram(str) 'True'
tf = 'False'; tf = pangram(str) 'True'
output = 'Pangram: ' tf :(return)
output = 'Pangram: ' tf :(return)
Line 3,259: Line 3,601:
panchk("My girl wove six dozen plaid jackets before she quit.")
panchk("My girl wove six dozen plaid jackets before she quit.")
panchk("This 41-character string: it's a pangram!")
panchk("This 41-character string: it's a pangram!")
end</lang>
end</syntaxhighlight>


{{out}}
{{out}}
Line 3,270: Line 3,612:


=={{header|Swift}}==
=={{header|Swift}}==
<lang Swift>import Foundation
<syntaxhighlight lang="swift">import Foundation


let str = "the quick brown fox jumps over the lazy dog"
let str = "the quick brown fox jumps over the lazy dog"
Line 3,285: Line 3,627:


isPangram(str) // True
isPangram(str) // True
isPangram("Test string") // False</lang>
isPangram("Test string") // False</syntaxhighlight>
Swift 2.0:
Swift 2.0:


<lang swift>func isPangram(str: String) -> Bool {
<syntaxhighlight lang="swift">func isPangram(str: String) -> Bool {
let (char, alph) = (Set(str.characters), "abcdefghijklmnopqrstuvwxyz".characters)
let (char, alph) = (Set(str.characters), "abcdefghijklmnopqrstuvwxyz".characters)
return !alph.contains {!char.contains($0)}
return !alph.contains {!char.contains($0)}
}</lang>
}</syntaxhighlight>


=={{header|Tcl}}==
=={{header|Tcl}}==
<lang tcl>proc pangram? {sentence} {
<syntaxhighlight lang="tcl">proc pangram? {sentence} {
set letters [regexp -all -inline {[a-z]} [string tolower $sentence]]
set letters [regexp -all -inline {[a-z]} [string tolower $sentence]]
expr {
expr {
Line 3,301: Line 3,643:
}
}
puts [pangram? "This is a sentence"]; # ==> false
puts [pangram? "This is a sentence"]; # ==> false
puts [pangram? "The quick brown fox jumps over the lazy dog."]; # ==> true</lang>
puts [pangram? "The quick brown fox jumps over the lazy dog."]; # ==> true</syntaxhighlight>


=={{header|TI-83 BASIC}}==
=={{header|TI-83 BASIC}}==
<lang ti83b>:Prompt Str1
<syntaxhighlight lang="ti83b">:Prompt Str1
:For(L,1,26
:For(L,1,26
:If not(inString(Str1,sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ",L,1))
:If not(inString(Str1,sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ",L,1))
Line 3,310: Line 3,652:
:End
:End
:If L<28
:If L<28
:Disp "IS A PANGRAM"</lang>
:Disp "IS A PANGRAM"</syntaxhighlight>
(not tested yet)
(not tested yet)


=={{header|TUSCRIPT}}==
=={{header|TUSCRIPT}}==
<lang tuscript>
<syntaxhighlight lang="tuscript">
$$ MODE TUSCRIPT,{}
$$ MODE TUSCRIPT,{}
alfabet="abcdefghijklmnopqrstuvwxyz"
alfabet="abcdefghijklmnopqrstuvwxyz"
Line 3,328: Line 3,670:
IF (chars_in_s!=alfabet) PRINT "no pangram: ",s
IF (chars_in_s!=alfabet) PRINT "no pangram: ",s
ENDLOOP
ENDLOOP
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 3,336: Line 3,678:


=={{header|TXR}}==
=={{header|TXR}}==
<lang txr>@/.*[Aa].*&.*[Bb].*&.*[Cc].*&.*[Dd].*& \
<syntaxhighlight lang="txr">@/.*[Aa].*&.*[Bb].*&.*[Cc].*&.*[Dd].*& \
.*[Ee].*&.*[Ff].*&.*[Gg].*&.*[Hh].*& \
.*[Ee].*&.*[Ff].*&.*[Gg].*&.*[Hh].*& \
.*[Ii].*&.*[Jj].*&.*[Kk].*&.*[Ll].*& \
.*[Ii].*&.*[Jj].*&.*[Kk].*&.*[Ll].*& \
Line 3,342: Line 3,684:
.*[Qq].*&.*[Rr].*&.*[Ss].*&.*[Tt].*& \
.*[Qq].*&.*[Rr].*&.*[Ss].*&.*[Tt].*& \
.*[Uu].*&.*[Vv].*&.*[Ww].*&.*[Xx].*& \
.*[Uu].*&.*[Vv].*&.*[Ww].*&.*[Xx].*& \
.*[Yy].*&.*[Zz].*/</lang>
.*[Yy].*&.*[Zz].*/</syntaxhighlight>


{{out|Run}}
{{out|Run}}
Line 3,354: Line 3,696:
=={{header|UNIX Shell}}==
=={{header|UNIX Shell}}==
{{works with|Bourne Again SHell}}
{{works with|Bourne Again SHell}}
{{works with|Korn Shell}}
<lang bash>function pangram? {
{{works with|Z Shell}}
local alphabet=abcdefghijklmnopqrstuvwxyz
<syntaxhighlight lang="bash">function is_pangram {
local string="$*"
typeset alphabet=abcdefghijklmnopqrstuvwxyz
string="${string,,}"
while [[ -n "$string" && -n "$alphabet" ]]; do
typeset -l string=$*
local ch="${string%%${string#?}}"
while [[ -n $string && -n $alphabet ]]; do
string="${string#?}"
typeset ch=${string%%${string#?}}
alphabet="${alphabet/$ch}"
string=${string#?}
alphabet=${alphabet/$ch}
done
done
[[ -z "$alphabet" ]]
[[ -z $alphabet ]]
}</lang>
}</syntaxhighlight>


=={{header|Ursala}}==
=={{header|Ursala}}==
<syntaxhighlight lang="ursala">
<lang Ursala>
#import std
#import std


is_pangram = ^jZ^(!@l,*+ @rlp -:~&) ~=`A-~ letters
is_pangram = ^jZ^(!@l,*+ @rlp -:~&) ~=`A-~ letters
</syntaxhighlight>
</lang>
example usage:
example usage:
<syntaxhighlight lang="ursala">
<lang Ursala>
#cast %bL
#cast %bL


test =
test =


is_pangram* <
is_pangram* <
'The quick brown fox jumps over the lazy dog',
'The quick brown fox jumps over the lazy dog',
'this is not a pangram'>
'this is not a pangram'>
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 3,392: Line 3,735:
Here is an alternative version:
Here is an alternative version:


<syntaxhighlight lang="vb">
<lang vb>
Function pangram2(s As String) As Boolean
Function pangram2(s As String) As Boolean
Const sKey As String = "abcdefghijklmnopqrstuvwxyz"
Const sKey As String = "abcdefghijklmnopqrstuvwxyz"
Dim sLow As String
Dim sLow As String
Dim i As Integer
Dim i As Integer

sLow = LCase(s)
sLow = LCase(s)
For i = 1 To 26
For i = 1 To 26
Line 3,407: Line 3,750:
pangram2 = True
pangram2 = True
End Function
End Function
</syntaxhighlight>
</lang>


Invocation e.g. (typed in the Immediate window):
Invocation e.g. (typed in the Immediate window):
Line 3,417: Line 3,760:
=={{header|VBScript}}==
=={{header|VBScript}}==
====Implementation====
====Implementation====
<lang vb>function pangram( s )
<syntaxhighlight lang="vb">function pangram( s )
dim i
dim i
dim sKey
dim sKey
Line 3,438: Line 3,781:
pangram = ( ltrim(sKey) = vbnullstring )
pangram = ( ltrim(sKey) = vbnullstring )
end function
end function

function eef( bCond, exp1, exp2 )
function eef( bCond, exp1, exp2 )
if bCond then
if bCond then
Line 3,445: Line 3,788:
eef = exp2
eef = exp2
end if
end if
end function</lang>
end function</syntaxhighlight>


====Invocation====
====Invocation====
<lang vb>wscript.echo eef(pangram("a quick brown fox jumps over the lazy dog"), "is a pangram", "is not a pangram")
<syntaxhighlight lang="vb">wscript.echo eef(pangram("a quick brown fox jumps over the lazy dog"), "is a pangram", "is not a pangram")
wscript.echo eef(pangram(""), "is a pangram", "is not a pangram")"</lang>
wscript.echo eef(pangram(""), "is a pangram", "is not a pangram")"</syntaxhighlight>


=={{header|VTL-2}}==
=={{header|VTL-2}}==
<lang VTL2>10 I=1
<syntaxhighlight lang="vtl2">10 I=1
20 :I)=0
20 :I)=0
30 I=I+1
30 I=I+1
Line 3,471: Line 3,814:
180 #=N=26*200
180 #=N=26*200
190 ?="not ";
190 ?="not ";
200 ?="a pangram"</lang>
200 ?="a pangram"</syntaxhighlight>
{{out}}
{{out}}
<pre>#=1
<pre>#=1
Line 3,486: Line 3,829:
=={{header|Wren}}==
=={{header|Wren}}==
{{libheader|Wren-str}}
{{libheader|Wren-str}}
<lang ecmascript>import "/str" for Str
<syntaxhighlight lang="wren">import "./str" for Str


var isPangram = Fn.new { |s|
var isPangram = Fn.new { |s|
Line 3,510: Line 3,853:
for (candidate in candidates) {
for (candidate in candidates) {
System.print(" %(candidate) -> %(isPangram.call(candidate))")
System.print(" %(candidate) -> %(isPangram.call(candidate))")
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 3,524: Line 3,867:


=={{header|XPL0}}==
=={{header|XPL0}}==
<lang XPL0>include c:\cxpl\codes; \intrinsic 'code' declarations
<syntaxhighlight lang="xpl0">include c:\cxpl\codes; \intrinsic 'code' declarations
string 0; \use zero-terminated strings
string 0; \use zero-terminated strings


Line 3,554: Line 3,897:
CrLf(0);
CrLf(0);
];
];
]</lang>
]</syntaxhighlight>


{{out}}
{{out}}
Line 3,562: Line 3,905:
no
no
</pre>
</pre>

=={{header|Yabasic}}==
<lang Yabasic>sub isPangram$(t$, l1$)
local lt, ll, r$, i, cc, ic
if numparams = 1 then
l1$ = "abcdefghijklmnopqrstuvwxyz"
end if
t$ = lower$(t$)
ll = len(l1$)
for i = 1 to ll
r$ = r$ + " "
next
lt = len(t$)
cc = asc("a")
for i = 1 to lt
ic = asc(mid$(t$, i, 1)) - cc + 1
if ic > 0 and ic <= ll then
mid$(r$, ic, 1) = chr$(ic + cc - 1)
end if
next i

if l1$ = r$ then return "true" else return "false" end if

end sub

print isPangram$("The quick brown fox jumps over the lazy dog.") // --> true
print isPangram$("The quick brown fox jumped over the lazy dog.") // --> false
print isPangram$("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ") // --> true</lang>


=={{header|zkl}}==
=={{header|zkl}}==
<lang zkl>var letters=["a".."z"].pump(String); //-->"abcdefghijklmnopqrstuvwxyz"
<syntaxhighlight lang="zkl">var letters=["a".."z"].pump(String); //-->"abcdefghijklmnopqrstuvwxyz"
fcn isPangram(text){(not (letters-text.toLower()))}</lang>
fcn isPangram(text){(not (letters-text.toLower()))}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>

Latest revision as of 18:16, 14 January 2024


Task
Pangram checker
You are encouraged to solve this task according to the task description, using any language you may know.

A pangram is a sentence that contains all the letters of the English alphabet at least once.

For example:   The quick brown fox jumps over the lazy dog.


Task

Write a function or method to check a sentence to see if it is a   pangram   (or not)   and show its use.


Related tasks



11l

F is_pangram(sentence)
   R Set(sentence.lowercase().filter(ch -> ch C ‘a’..‘z’)).len == 26

L(sentence) [‘The quick brown fox jumps over the lazy dog.’,
             ‘The quick brown fox jumped over the lazy dog.’]
   print(‘'#.' is #.a pangram’.format(sentence, ‘not ’ * !is_pangram(sentence)))
Output:
'The quick brown fox jumps over the lazy dog.' is a pangram
'The quick brown fox jumped over the lazy dog.' is not a pangram

360 Assembly

*        Pangram RC                11/08/2015
PANGRAM  CSECT
         USING  PANGRAM,R12
         LR     R12,R15
BEGIN    LA     R9,SENTENCE
         LA     R6,4
LOOPI    LA     R10,ALPHABET       loop on sentences
         LA     R7,26
LOOPJ    LA     R5,0               loop on letters
         LR     R11,R9
         LA     R8,60
LOOPK    MVC    BUFFER+1(1),0(R10) loop in sentence
         CLC    0(1,R10),0(R11)    if alphabet[j=sentence[i]
         BNE    NEXTK
         LA     R5,1               found
NEXTK    LA     R11,1(R11)         next character
         BCT    R8,LOOPK
         LTR    R5,R5              if found
         BNZ    NEXTJ
         MVI    BUFFER,C'?'        not found
         B      PRINT
NEXTJ    LA     R10,1(R10)         next letter
         BCT    R7,LOOPJ
         MVC    BUFFER(2),=CL2'OK'
PRINT    MVC    BUFFER+3(60),0(R9)
         XPRNT  BUFFER,80
NEXTI    LA     R9,60(R9)          next sentence
         BCT    R6,LOOPI
RETURN   XR     R15,R15
         BR     R14
ALPHABET DC     CL26'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
SENTENCE DC     CL60'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.'
         DC     CL60'THE FIVE BOXING WIZARDS DUMP QUICKLY.'
         DC     CL60'HEAVY BOXES PERFORM WALTZES AND JIGS.'
         DC     CL60'PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.'
BUFFER   DC     CL80' '
         YREGS
         END    PANGRAM
Output:
OK THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
?J THE FIVE BOXING WIZARDS DUMP QUICKLY.
?C HEAVY BOXES PERFORM WALTZES AND JIGS.
OK PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.

ACL2

(defun contains-each (needles haystack)
   (if (endp needles)
       t
       (and (member (first needles) haystack)
            (contains-each (rest needles) haystack))))

(defun pangramp (str)
   (contains-each (coerce "abcdefghijklmnopqrstuvwxyz" 'list)
                  (coerce (string-downcase str) 'list)))

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
Output:

Screenshot from Atari 8-bit computer

"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.

ActionScript

Works with: ActionScript version 2.0
function pangram(k:string):Boolean {
  var lowerK:String = k.toLowerCase();
  var has:Object = {}

  for (var i:Number=0; i<=k.length-1; i++) {
    has[lowerK.charAt(i)] = true;
  }

  var result:Boolean = true;

  for (var ch:String='a'; ch <= 'z'; ch=String.fromCharCode(ch.charCodeAt(0)+1)) {
      result = result && has[ch]
  }

  return result || false;
}

Ada

Using character sets

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure pangram is

   function ispangram(txt: String) return Boolean is
     (Is_Subset(To_Set(Span => ('a','z')), To_Set(To_Lower(txt))));

begin
   put_line(Boolean'Image(ispangram("This is a test")));
   put_line(Boolean'Image(ispangram("The quick brown fox jumps over the lazy dog")));
   put_line(Boolean'Image(ispangram("NOPQRSTUVWXYZ  abcdefghijklm")));
   put_line(Boolean'Image(ispangram("abcdefghijklopqrstuvwxyz"))); --Missing m, n
end pangram;

Using quantified expressions

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
procedure pangram is

  function ispangram(txt : in String) return Boolean is
     (for all Letter in Character range 'a'..'z' =>
         (for some Char of txt => To_Lower(Char) = Letter));

begin
   put_line(Boolean'Image(ispangram("This is a test")));
   put_line(Boolean'Image(ispangram("The quick brown fox jumps over the lazy dog")));
   put_line(Boolean'Image(ispangram("NOPQRSTUVWXYZ  abcdefghijklm")));
   put_line(Boolean'Image(ispangram("abcdefghijklopqrstuvwxyz"))); --Missing m, n
end pangram;
Output:
FALSE
TRUE
TRUE
FALSE

ALGOL 68

Works with: ALGOL 68 version Standard - no extensions to language used
Works with: ALGOL 68G version Any - tested with release 1.18.0-9h.tiny
Works with: ELLA ALGOL 68 version Any (with appropriate job cards)
# init pangram: #
INT la = ABS "a", lz = ABS "z";
INT ua = ABS "A", uz = ABS "Z";
IF lz-la+1 > bits width THEN
  put(stand error, "Exception: insufficient bits in word for task");
  stop
FI;

PROC is a pangram = (STRING test)BOOL: (
  BITS a2z := BIN(ABS(2r1 SHL (lz-la))-1); # assume: ASCII & Binary #
  FOR i TO UPB test WHILE
    INT c = ABS test[i];
    IF la <= c AND c <= lz THEN
      a2z := a2z AND NOT(2r1 SHL (c-la))
    ELIF ua <= c AND c <= uz THEN
      a2z := a2z AND NOT(2r1 SHL (c-ua))
    FI;
# WHILE # a2z /= 2r0 DO
    SKIP
  OD;
  a2z = 2r0
);

main:(
  []STRING test list = (
    "Big fjiords vex quick waltz nymph",
    "The quick brown fox jumps over a lazy dog",
    "A quick brown fox jumps over a lazy dog"
  );
  FOR key TO UPB test list DO
    STRING test = test list[key];
    IF is a pangram(test) THEN
      print(("""",test,""" is a pangram!", new line))
    FI
  OD
)
Output:
"Big fjiords vex quick waltz nymph" is a pangram!
"The quick brown fox jumps over a lazy dog" is a pangram!

APL

    a'abcdefghijklmnopqrstuvwxyz' ⍝ or ⎕ucs 96 + ⍳26 in GNU/Dyalog
    A'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ⍝ or ⎕ucs 64 + ⍳26, or just ⎕a in Dyalog

    Pangram  {/  2 26(a,A)  }
    Pangram 'This should fail'
0
    Pangram 'The quick brown fox jumps over the lazy dog'
1

AppleScript

AppleScriptObjC

Out of the box, AppleScript lacks many library basics – no regex, no higher order functions, not even string functions for mapping to upper or lower case.

From OSX 10.10 onwards, we can, however, use ObjC functions from AppleScript by importing the Foundation framework. We do this below to get a toLowerCase() function. If we also add generic filter and map functions, we can write and test a simple isPangram() function as follows:

use framework "Foundation" -- ( for case conversion function )

--------------------- PANGRAM CHECKER --------------------

-- isPangram :: String -> Bool
on isPangram(s)
    script charUnUsed
        property lowerCaseString : my toLower(s)
        on |λ|(c)
            lowerCaseString does not contain c
        end |λ|
    end script

    0 = length of filter(charUnUsed, ¬
        "abcdefghijklmnopqrstuvwxyz")
end isPangram


--------------------------- TEST -------------------------
on run
    map(isPangram, {¬
        "is this a pangram", ¬
        "The quick brown fox jumps over the lazy dog"})

    --> {false, true}
end run


-------------------- GENERIC FUNCTIONS -------------------

-- filter :: (a -> Bool) -> [a] -> [a]
on filter(f, xs)
    tell mReturn(f)
        set lst to {}
        set lng to length of xs
        repeat with i from 1 to lng
            set v to item i of xs
            if |λ|(v, i, xs) then set end of lst to v
        end repeat
        return lst
    end tell
end filter


-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
    tell mReturn(f)
        set lng to length of xs
        set lst to {}
        repeat with i from 1 to lng
            set end of lst to |λ|(item i of xs, i, xs)
        end repeat
        return lst
    end tell
end map


-- Lift 2nd class handler function into
-- 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
    if class of f is script then
        f
    else
        script
            property |λ| : f
        end script
    end if
end mReturn


-- toLower :: String -> String
on toLower(str)
    set ca to current application
    ((ca's NSString's stringWithString:(str))'s ¬
        lowercaseStringWithLocale:(ca's NSLocale's currentLocale())) as text
end toLower
Output:
{false, true}

Core language

Contrary to the impression given above, AppleScript is perfectly capable of handling this task very simply and without the need for imported libraries.

on isPangram(txt)
    set alphabet to "abcedfghijklmnopqrstuvwxyz"
    ignoring case -- The default, but ensure it here.
        repeat with letter in alphabet
            if (txt does not contain letter) then return false
        end repeat
    end ignoring

    return true
end isPangram

local result1, result2
set result1 to isPangram("The Quick Brown Fox Jumps Over The Lazy Dog")
set result2 to isPangram("This is not a pangram")
return {result1, result2}
Output:
{true, false}

Arturo

chars: map 97..122 => [to :string to :char &]
pangram?: function [sentence][
    every? chars 'ch ->
        in? ch sentence
]

print pangram? "this is a sentence"
print pangram? "The quick brown fox jumps over the lazy dog."
Output:
false
true

ATS

(* ****** ****** *)
//
#include
"share/atspre_staload.hats"
#include
"share/HATS/atspre_staload_libats_ML.hats"
//
(* ****** ****** *)
//
fun
letter_check
(
cs: string, c0: char
) : bool = cs.exists()(lam(c) => c0 = c)
//
(* ****** ****** *)

fun
Pangram_check
  (text: string): bool = let
//
val
alphabet = "abcdefghijklmnopqrstuvwxyz"
val
((*void*)) = assertloc(length(alphabet) = 26)
//
in
  alphabet.forall()(lam(c) => letter_check(text, c) || letter_check(text, toupper(c)))
end // end of [Pangram_check]

(* ****** ****** *)

implement
main0 () =
{
//
val
text0 = "The quick brown fox jumps over the lazy dog."
//
val-true = Pangram_check(text0)
val-false = Pangram_check("This is not a pangram sentence.")
//
} (* end of [main0] *)

(* ****** ****** *)

An alternate implementation that makes a single pass through the string:

fn is_pangram{n:nat}(s: string(n)): bool = loop(s, i2sz(0)) where {
  val letters: arrayref(bool, 26) = arrayref_make_elt<bool>(i2sz(26), false)
  fn check(): bool = loop(0) where {
    fun loop{i:int | i >= 0 && i <= 26}(i: int(i)) =
      if i < 26 then
        if letters[i] then loop(i+1) else
        false
      else true
  }
  fun add{c:int}(c: char(c)): void =
    if (c >= 'A') * (c <= 'Z') then letters[char2int1(c) - char2int1('A')] := true else
    if (c >= 'a') * (c <= 'z') then letters[char2int1(c) - char2int1('a')] := true
  fun loop{i:nat | i <= n}.<n-i>.(s: string(n), i: size_t(i)): bool =
    if string_is_atend(s, i) then check() else
    begin
      add(s[i]);
      loop(s, succ(i))
    end
}

AutoHotkey

Gui, -MinimizeBox
Gui, Add, Edit, w300 r5 vText
Gui, Add, Button, x105 w100 Default, Check Pangram
Gui, Show,, Pangram Checker
Return

GuiClose:
    ExitApp
Return

ButtonCheckPangram:
    Gui, Submit, NoHide
    Loop, 26
        If Not InStr(Text, Char := Chr(64 + A_Index)) {
            MsgBox,, Pangram, Character %Char% is missing!
            Return
        }
    MsgBox,, Pangram, OK`, this is a Pangram!
Return

AutoIt

Pangram("The quick brown fox jumps over the lazy dog")
Func Pangram($s_String)
For $i = 1 To 26
	IF Not StringInStr($s_String, Chr(64 + $i)) Then
		Return MsgBox(0,"No Pangram", "Character " & Chr(64 + $i) &" is missing")
	EndIf
Next
Return MsgBox(0,"Pangram", "Sentence is a Pangram")
EndFunc

AWK

Solution using string-operations

#!/usr/bin/awk -f
BEGIN {
   allChars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   print isPangram("The quick brown fox jumps over the lazy dog.");
   print isPangram("The quick brown fo.");
}

function isPangram(string) {
    delete X;
    for (k=1; k<length(string); k++) {
        X[toupper(substr(string,k,1))]++;  # histogram
    }
    for (k=1; k<=length(allChars); k++) {
        if (!X[substr(allChars,k,1)]) return 0;
    }
    return 1;
}
Output:
1
0

Solution using associative arrays and split

Works with: gawk version 4.1.0
Works with: mawk version 1.3.3
# usage: awk -f pangram.awk -v p="The five boxing wizards dump quickly." input.txt
#
# Pangram-checker, using associative arrays and split
BEGIN {
  alfa="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ac=split(alfa,A,"")
  print "# Checking for all",ac,"chars in '" alfa "' :"

  print testPangram("The quick brown fox jumps over the lazy dog.");
  print testPangram(p);
}

{ print testPangram($0) }

function testPangram(str,   c,i,S,H,hit,miss) {
    print str  						##
    split( toupper(str), S, "")
    for (c in S) {
      H[ S[c] ]++
     #print c, S[c], H[ S[c] ]				##
    }
    for (i=1; i<=ac; i++) {
      c = A[i]
     #printf("%2d %c : %4d\n", i, c, H[c] )  		##
      if (H[c]) { hit=hit c } else { miss=miss c }
    }
    print "# hit:",hit, "# miss:",miss, "."		##
    if (miss) return 0
    return 1
}
Output:
# Checking for all 26 chars in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' :
The quick brown fox jumps over the lazy dog.
# hit: ABCDEFGHIJKLMNOPQRSTUVWXYZ # miss:  .
1
The five boxing wizards dump quickly.
# hit: ABCDEFGHIKLMNOPQRSTUVWXYZ # miss: J .
0
Heavy boxes perform waltzes and jigs
# hit: ABDEFGHIJLMNOPRSTVWXYZ # miss: CKQU .
0
The quick onyx goblin jumps over the lazy dwarf.
# hit: ABCDEFGHIJKLMNOPQRSTUVWXYZ # miss:  .
1
Pack my box with five dozen liquor jugs
# hit: ABCDEFGHIJKLMNOPQRSTUVWXYZ # miss:  .
1

BASIC

Applesoft BASIC

 100  P$ = "11111111111111111111111111"
 110  FOR Q = 1 TO 3
 120      READ S$
 130      GOSUB 200"IS PANGRAM?
 140      PRINT  MID$ ("NO  YES ",P * 4 + 1,4)S$
 150  NEXT Q
 160  END
 170  DATA"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG."
 180  DATA"THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG."
 190  DATA"THE FIVE BOXING WIZARDS JUMP QUICKLY."
 200  P = 0:L =  LEN (S$): IF  NOT L THEN  RETURN 
 210  F$ = "00000000000000000000000000"
 220  FOR I = 1 TO L
 230      C =  ASC ( MID$ (S$,I,1)):C = C - 32 * (C > 95): IF C > 64 AND C < 91 THEN J = C - 64:F$ =  MID$ (F$,1,J - 1) + "1" +  MID$ (F$,J + 1):P = F$ = P$: IF P THEN  RETURN 
 240  NEXT I
 250  RETURN
Output:
YES THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
NO  THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.
YES THE FIVE BOXING WIZARDS JUMP QUICKLY.

BaCon

This can be done in a one-liner.

DEF FN Pangram(x) = IIF(AMOUNT(UNIQ$(EXPLODE$(EXTRACT$(LCASE$(x), "[^[:alpha:]]", TRUE), 1))) = 26, TRUE, FALSE)

PRINT Pangram("The quick brown fox jumps over the lazy dog.")
PRINT Pangram("Jackdaws love my big sphinx of quartz.")
PRINT Pangram("My dog has fleas.")
PRINT Pangram("What's a jackdaw?")
PRINT Pangram("The five boxing wizards jump quickly")
Output:
1
1
0
0
1

BASIC256

function isPangram$(texto$)
    longitud = Length(texto$)
    if longitud < 26 then return "is not a pangram"
    t$ = lower(texto$)
    print "'"; texto$; "' ";
    for i = 97 to 122
        if instr(t$, chr(i)) = 0 then return "is not a pangram"
    next i
    return "is a pangram"
end function

print isPangram$("The quick brown fox jumps over the lazy dog.")   # --> true
print isPangram$("The quick brown fox jumped over the lazy dog.")  # --> false
print isPangram$("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ")          # --> true

BBC BASIC

      FOR test% = 1 TO 2
        READ test$
        PRINT """" test$ """ " ;
        IF FNpangram(test$) THEN
          PRINT "is a pangram"
        ELSE
          PRINT "is not a pangram"
        ENDIF
      NEXT test%
      END

      DATA "The quick brown fox jumped over the lazy dog"
      DATA "The five boxing wizards jump quickly"

      DEF FNpangram(A$)
      LOCAL C%
      A$ = FNlower(A$)
      FOR C% = ASC("a") TO ASC("z")
        IF INSTR(A$, CHR$(C%)) = 0 THEN = FALSE
      NEXT
      = TRUE

      DEF FNlower(A$)
      LOCAL A%, C%
      FOR A% = 1 TO LEN(A$)
        C% = ASCMID$(A$,A%)
        IF C% >= 65 IF C% <= 90 MID$(A$,A%,1) = CHR$(C%+32)
      NEXT
      = A$
Output:
"The quick brown fox jumped over the lazy dog" is not a pangram
"The five boxing wizards jump quickly" is a pangram

String manipulation is expensive, especially in loops, so it may be better to buffer the string and use character values:

DEFFNisPangram(text$)
  LOCAL size%,text%,char%,bits%
  size%=LENtext$
  IF size%<27 THEN =FALSE:REM too few characters
  DIM text% LOCAL size%:REM BB4W and RISC OS 5 only
  $text%=text$:REM buffer the string
  FOR text%=text% TO text%+size%-1:REM each character
    char%=?text% OR 32:REM to lower case
    IF 96<char% AND char%<123 THEN bits%=bits% OR 1<<(char%-97):REM set ordinal bit
    IF bits%=&3FFFFFF THEN =TRUE:REM all ordinal bits set
  NEXT text%
=FALSE

Commodore BASIC

10 rem detect model for title display
20 mx=peek(213): if mx=21 or mx=39 or mx=79 then 50:rem pet, vic, c64
30 mx=peek(238): if mx=39 or mx=79 then 50: rem c128
40 mx=39:color 4,1:rem assume plus/4 or c-16
50 if mx=21 then poke 36879,30:rem fix color on vic-20
60 print chr$(147);chr$(14);chr$(18);"**";:for i=2 to (mx-15)/2:print " ";:next
70 print "Pangram Checker";
80 for i=(mx-15)/2+16 to mx-2: print " ";: next: print "**"
100 read s$
110 if len(s$)=0 then end
120 gosub 1000:print
130 print "'"s$"' is";
140 if p=0 then print " not";
150 print " a pangram."
160 goto 100
500 data "The quick brown fox jumps over the lazy dog."
510 data "The quick brown fox jumped over the lazy dog."
520 data "The five boxing wizards jump quickly."
530 data
900 rem pangram checker
1000 if f=0 then f=1:dim seen(25),a(2):a(0)=65:a(1)=97:a(2)=193:goto 1020
1010 for i=0 to 25:seen(i)=0:next
1020 for i=1 to len(s$)
1030 : c=asc(mid$(s$,i))
1040 : for a = 0 to 2
1050 :   if c>=a(a) and c<=a(a)+25 then seen(c-a(a))=seen(c-a(a))+1
1060 : next a
1070 next i
1080 p=-1
1090 for i=0 to 25
1100 : if seen(i)=0 then p=0:i=25
1110 next i
1120 return
Output:
**                               Pangram Checker                              **


'The quick brown fox jumps over the lazy dog.' is a pangram.

'The quick brown fox jumped over the lazy dog.' is not a pangram.

'The five boxing wizards jump quickly.' is a pangram.

ready.

Chipmunk Basic

The Applesoft BASIC solution works without any changes.

FreeBASIC

' FB 1.05.0 Win64

Function isPangram(s As Const String) As Boolean
  Dim As Integer length = Len(s)
  If length < 26 Then Return False
  Dim p As String = LCase(s)
  For i As Integer = 97 To 122
    If Instr(p, Chr(i)) = 0 Then Return False
  Next
  Return True
End Function

Dim s(1 To 3) As String = _
{ _
 "The quick brown fox jumps over the lazy dog", _
 "abbdefghijklmnopqrstuVwxYz", _ '' no c!
 "How vexingly quick daft zebras jump!" _
}

For i As Integer = 1 To 3:
  Print "'"; s(i); "' is "; IIf(isPangram(s(i)), "a", "not a"); " pangram"
  Print
Next

Print
Print "Press nay key to quit"
Sleep
Output:
'The quick brown fox jumps over the lazy dog' is a pangram

'abbdefghijklmnopqrstuVwxYz' is not a pangram

'How vexingly quick daft zebras jump!' is a pangram

Liberty BASIC

'Returns 0 if the string is NOT a pangram or >0 if it IS a pangram
string$ = "The quick brown fox jumps over the lazy dog."

Print isPangram(string$)

Function isPangram(string$)
    string$ = Lower$(string$)
    For i = Asc("a") To Asc("z")
        isPangram = Instr(string$, chr$(i))
        If isPangram = 0 Then Exit Function
    Next i
End Function

PureBasic

Procedure IsPangram_fast(String$)
  String$ = LCase(string$)
  char_a=Asc("a")
  ; sets bits in a variable if a letter is found, reads string only once
  For a = 1 To Len(string$)
    char$ = Mid(String$, a, 1)
    pos   = Asc(char$) - char_a
    check.l |  1 << pos
  Next
  If check & $3FFFFFF = $3FFFFFF
    ProcedureReturn 1
  EndIf
  ProcedureReturn 0
EndProcedure

Procedure IsPangram_simple(String$)
  String$ = LCase(string$)
  found   = 1
  For a = Asc("a") To Asc("z")
  ; searches for every letter in whole string
    If FindString(String$, Chr(a), 0) = 0
      found = 0
    EndIf
  Next
  ProcedureReturn found
EndProcedure

Debug IsPangram_fast("The quick brown fox jumps over lazy dogs.")
Debug IsPangram_simple("The quick brown fox jumps over lazy dogs.")
Debug IsPangram_fast("No pangram")
Debug IsPangram_simple("No pangram")


QBasic

DECLARE FUNCTION IsPangram! (sentence AS STRING)

DIM x AS STRING

x = "My dog has fleas."
GOSUB doIt
x = "The lazy dog jumps over the quick brown fox."
GOSUB doIt
x = "Jackdaws love my big sphinx of quartz."
GOSUB doIt
x = "What's a jackdaw?"
GOSUB doIt

END

doIt:
    PRINT IsPangram!(x), x
    RETURN

FUNCTION IsPangram! (sentence AS STRING)
    'returns -1 (true) if sentence is a pangram, 0 (false) otherwise
    DIM l AS INTEGER, s AS STRING, t AS INTEGER
    DIM letters(25) AS INTEGER

    FOR l = 1 TO LEN(sentence)
        s = UCASE$(MID$(sentence, l, 1))
        SELECT CASE s
            CASE "A" TO "Z"
                t = ASC(s) - 65
                letters(t) = 1
        END SELECT
    NEXT

    FOR l = 0 TO 25
        IF letters(l) < 1 THEN
            IsPangram! = 0
            EXIT FUNCTION
        END IF
    NEXT

    IsPangram! = -1
END FUNCTION
Output:
  0            My dog has fleas.
 -1            The quick brown fox jumps over the lazy dog.
 -1            Jackdaws love my big sphinx of quartz.
  0            What's a jackdaw?

Run BASIC

s$ = "The quick brown fox jumps over the lazy dog."
Print pangram(s$);" ";s$

s$ = "My dog has fleas."
Print pangram(s$);" ";s$

function pangram(str$)
  str$  = lower$(str$)
  for i = asc("a") to asc("z")
      pangram = pangram + (instr(str$, chr$(i)) <> 0)
  next i
pangram = (pangram = 26)
end function
1 The quick brown fox jumps over the lazy dog.
0 My dog has fleas.

Sinclair ZX81 BASIC

Works (just) with the 1k RAM model. The "37" that crops up a couple of times stops being a mystery if we remember that the ZX81 character code for A is 38 and that strings (like arrays) are indexed from 1, not from 0.

 10 LET A$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 20 LET L=26
 30 INPUT P$
 40 IF LEN P$<26 THEN GOTO 170
 50 FAST
 60 LET C=1
 70 IF P$(C)<"A" OR P$(C)>"Z" THEN GOTO 120
 80 IF A$(CODE P$(C)-37)=" " THEN GOTO 120
 90 LET A$(CODE P$(C)-37)=" "
100 LET L=L-1
110 IF L=0 THEN GOTO 150
120 IF C=LEN P$ THEN GOTO 170
130 LET C=C+1
140 GOTO 70
150 PRINT "PANGRAM"
160 GOTO 180
170 PRINT "NOT A PANGRAM"
180 SLOW
Input:
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
Output:
PANGRAM
Input:
AND DARK THE SUN AND MOON, AND THE ALMANACH DE GOTHA
Output:
NOT A PANGRAM

uBasic/4tH

Proc _ShowPangram ("The quick brown fox jumps over the lazy dog.")
Proc _ShowPangram ("QwErTyUiOpAsDfGhJkLzXcVbNm")
Proc _ShowPangram ("Not a pangram")

End

_ShowPangram                           ' demonstrate the Pangram() function
  Param (1)
  Print Show (a@);Tab (50);Show (Iif (FUNC(_Pangram (a@)), "A pangram", "Not a pangram"))
Return

_Pangram
  Param (1)                            ' pangram candidate
  Local (3)

  b@ = 0                               ' reset the bitmap

  For d@ = 0 To Len(a@) -1             ' parse the string
    c@ = Peek (a@, d@)                 ' get current character
    If (c@ > Ord ("A") - 1) * (c@ < Ord ("Z") + 1) Then c@ = c@ + 32
    If (c@ > Ord ("a") - 1) * (c@ < Ord ("z") + 1) Then b@ = OR(b@, 2^(c@ - Ord ("a")))
  Next                                 ' update the bitmap
Return (b@ = 67108863)                 ' all bits set?
Output:
The quick brown fox jumps over the lazy dog.      A pangram
QwErTyUiOpAsDfGhJkLzXcVbNm                        A pangram
Not a pangram                                     Not a pangram

0 OK, 0:156

Yabasic

sub isPangram$(t$, l1$)
	local lt, ll, r$, i, cc, ic

	if numparams = 1 then
		l1$ = "abcdefghijklmnopqrstuvwxyz"
	end if

	t$ = lower$(t$)
	ll = len(l1$)
	for i = 1 to ll
		r$ = r$ + " "
	next
	lt = len(t$)
	cc = asc("a")

	for i = 1 to lt
		ic = asc(mid$(t$, i, 1)) - cc + 1
		if ic > 0 and ic <= ll then
			mid$(r$, ic, 1) = chr$(ic + cc - 1)
		end if
	next i

	if l1$ = r$ then return "true" else return "false" end if

end sub

print isPangram$("The quick brown fox jumps over the lazy dog.")   // --> true
print isPangram$("The quick brown fox jumped over the lazy dog.")  // --> false
print isPangram$("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ")          // --> true

Batch File

@echo off
setlocal enabledelayedexpansion

	%===The Main Thing===%
call :pangram "The quick brown fox jumps over the lazy dog."
call :pangram "The quick brown fox jumped over the lazy dog."
echo.
pause
exit /b 0

	%===The Function===%
:pangram
set letters=abcdefgihjklmnopqrstuvwxyz
set cnt=0
set inp=%~1
set str=!inp: =!

:loop
set chr=!str:~%cnt%,1!
if "!letters!"=="" (
	echo %1 is a pangram^^!
	goto :EOF
)
if "!chr!"=="" (
	echo %1 is not a pangram.
	goto :EOF
)
set letters=!letters:%chr%=!
set /a cnt+=1
goto loop
Output:
"The quick brown fox jumps over the lazy dog." is a pangram!
"The quick brown fox jumped over the lazy dog." is not a pangram.

Press any key to continue . . .

BCPL

get "libhdr"

// Test if s is a pangram. The ASCII character set is assumed.
let pangram(s) = valof
$(  let letters = vec 25
    for i=0 to 25 do letters!i := false
    for i=1 to s%0 do
    $(  let c = (s%i | 32) - 'a'
        if c >= 0 & c < 26 then
            letters!c := true
    $)
    for i=0 to 25 unless letters!i resultis false
    resultis true
$)

// Display s and whether or not it is a pangram.
let check(s) be
$(  writes(s)
    writes(" -> ")
    test pangram(s)
        then writes("yes*N")
        else writes("no*N")
$)

let start() be
$(  check("The quick brown fox jumps over the lazy dog.")
    check("The five boxing wizards dump quickly.")
$)
Output:
The quick brown fox jumps over the lazy dog. -> yes
The five boxing wizards dump quickly. -> no

Befunge

Reads the sentence to test from stdin.

>~>:65*`!#v_:"`"`48*v>g+04p1\4p
^#*`\*93\`0<::-"@"-*<^40!%2g4:_
"pangram."<v*84<_v#-":"g40\" a"
>>:#,_55+,@>"ton">48*>"si tahT"
Input:
The quick brown fox jumps over the lazy dog.
Output:
That is a pangram.

Bracmat

(isPangram=
  k
.   low$!arg:?arg
  & a:?k
  &   whl
    ' ( @(!arg:? !k ?)
      & chr$(1+asc$!k):?k:~>z
      )
  & !k:>z
  &
);

Some examples:

isPangram$("the Quick brown FOX jumps over the lazy do")
no
isPangram$("the Quick brown FOX jumps over the lazy dog")
yes
isPangram$"My dog has fleas."
no
isPangram$"The quick brown fox jumps over the lazy dog."
yes
isPangram$"Jackdaws love my big sphinx of quartz."
yes
isPangram$"What's a jackdaw?"
no
isPangram$"Lynx c.q. vos prikt bh: dag zwemjuf!"
yes

Brat

pangram? = { sentence |
  letters = [:a :b :c :d :e :f :g :h :i :j :k :l :m
    :n :o :p :q :r :s :t :u :v :w :x :y :z]

    sentence.downcase!

    letters.reject! { l |
      sentence.include? l
    }

  letters.empty?
}

p pangram? 'The quick brown fox jumps over the lazy dog.' #Prints true
p pangram? 'Probably not a pangram.'  #Prints false

Alternative version:

pangram? = { sentence |
  sentence.downcase.dice.unique.select(:alpha?).length == 26
}

C

#include <stdio.h>

int is_pangram(const char *s)
{
	const char *alpha = ""
		"abcdefghjiklmnopqrstuvwxyz"
		"ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	char ch, wasused[26] = {0};
	int total = 0;

	while ((ch = *s++) != '\0') {
		const char *p;
		int idx;

		if ((p = strchr(alpha, ch)) == NULL)
			continue;

		idx = (p - alpha) % 26;

		total += !wasused[idx];
		wasused[idx] = 1;
		if (total == 26)
			return 1;
	}
	return 0;
}

int main(void)
{
	int i;
	const char *tests[] = {
		"The quick brown fox jumps over the lazy dog.",
		"The qu1ck brown fox jumps over the lazy d0g."
	};

	for (i = 0; i < 2; i++)
		printf("\"%s\" is %sa pangram\n",
			tests[i], is_pangram(tests[i])?"":"not ");
	return 0;
}

Using bitmask

Assumes an execution environment using the ASCII character set (will invoke undefined behavior on other systems).

#include <stdio.h>

int pangram(const char *s)
{
	int c, mask = (1 << 26) - 1;
	while ((c = (*s++)) != '\0') /* 0x20 converts lowercase to upper */
		if ((c &= ~0x20) <= 'Z' && c >= 'A')
			mask &= ~(1 << (c - 'A'));

	return !mask;
}

int main()
{
	int i;
	const char *s[] = {	"The quick brown fox jumps over lazy dogs.",
				"The five boxing wizards dump quickly.",  };

	for (i = 0; i < 2; i++)
		printf("%s: %s\n", pangram(s[i]) ? "yes" : "no ", s[i]);

	return 0;
}
Output:
yes: The quick brown fox jumps over lazy dogs.
no : The five boxing wizards dump quickly.

C#

C# 3.0 or higher (.NET Framework 3.5 or higher)

using System;
using System.Linq;

static class Program
{
    static bool IsPangram(this string text, string alphabet = "abcdefghijklmnopqrstuvwxyz")
    {
        return alphabet.All(text.ToLower().Contains);
    }

    static void Main(string[] arguments)
    {
        Console.WriteLine(arguments.Any() && arguments.First().IsPangram());
    }
}

Any version of C# language and .NET Framework

using System;

namespace PangrammChecker
{
    public class PangrammChecker
    {
        public static bool IsPangram(string str)
        {
            bool[] isUsed = new bool[26];
            int ai = (int)'a';
            int total = 0;
            for (CharEnumerator en = str.ToLower().GetEnumerator(); en.MoveNext(); )
            {
                int d = (int)en.Current - ai;
                if (d >= 0 && d < 26)
                    if (!isUsed[d])
                    {
                        isUsed[d] = true;
                        total++;
                    }
            }
            return (total == 26);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string str1 = "The quick brown fox jumps over the lazy dog.";
            string str2 = "The qu1ck brown fox jumps over the lazy d0g.";
            Console.WriteLine("{0} is {1}a pangram", str1,
                PangrammChecker.IsPangram(str1)?"":"not ");
            Console.WriteLine("{0} is {1}a pangram", str2,
                PangrammChecker.IsPangram(str2)?"":"not ");
            Console.WriteLine("Press Return to exit");
            Console.ReadLine();
        }
    }
}

C++

#include <algorithm>
#include <cctype>
#include <string>
#include <iostream>

const std::string alphabet("abcdefghijklmnopqrstuvwxyz");

bool is_pangram(std::string s)
{
    std::transform(s.begin(), s.end(), s.begin(), ::tolower);
    std::sort(s.begin(), s.end());
    return std::includes(s.begin(), s.end(), alphabet.begin(), alphabet.end());
}

int main()
{
    const auto examples = {"The quick brown fox jumps over the lazy dog",
                           "The quick white cat jumps over the lazy dog"};

    std::cout.setf(std::ios::boolalpha);
    for (auto& text : examples) {
        std::cout << "Is \"" << text << "\" a pangram? - " << is_pangram(text) << std::endl;
    }
}

Ceylon

shared void run() {

	function pangram(String sentence) =>
 		let(alphabet = set('a'..'z'),
			letters = set(sentence.lowercased.filter(alphabet.contains)))
 		letters == alphabet;

 	value sentences = [
 		"The quick brown fox jumps over the lazy dog",
 		"""Watch "Jeopardy!", Alex Trebek's fun TV quiz game.""",
 		"Pack my box with five dozen liquor jugs.",
 		"blah blah blah"
 	];
 	for(sentence in sentences) {
 		print("\"``sentence``\" is a pangram? ``pangram(sentence)``");
 	}
}

Clojure

(defn pangram? [s]
  (let [letters (into #{} "abcdefghijklmnopqrstuvwxyz")]
    (= (->> s .toLowerCase (filter letters) (into #{})) letters)))

CLU

pangram = proc (s: string) returns (bool)
    letters: array[bool] := array[bool]$fill(0,26,false)
    for c: char in string$chars(s) do
        if c>='a' & c<='z' then
            c := char$i2c(char$c2i(c) - 32)
        end
        if c>='A' & c<='Z' then
            letters[char$c2i(c) - 65] := true
        end
    end
    for seen: bool in array[bool]$elements(letters) do
        if ~seen then return(false) end
    end
    return(true)
end pangram

start_up = proc ()
    po: stream := stream$primary_output()
    examples: array[string] := array[string]$[
        "The quick brown fox jumps over the lazy dog.",
        "The five boxing wizards dump quickly.",
        "abcdefghijklmnopqrstuvwxyz"
    ]

    for example: string in array[string]$elements(examples) do
        stream$puts(po, "\"" || example || "\" is")
        if ~pangram(example) then
            stream$puts(po, " not")
        end
        stream$putl(po, " a pangram.")
    end
end start_up
Output:
"The quick brown fox jumps over the lazy dog." is a pangram.
"The five boxing wizards dump quickly." is not a pangram.
"abcdefghijklmnopqrstuvwxyz" is a pangram.

COBOL

       identification division.
       program-id. pan-test.
       data division.
       working-storage section.
       1 text-string pic x(80).
       1 len binary pic 9(4).
       1 trailing-spaces binary pic 9(4).
       1 pangram-flag pic x value "n".
        88 is-not-pangram value "n".
        88 is-pangram value "y".
       procedure division.
       begin.
           display "Enter text string:"
           accept text-string
           set is-not-pangram to true
           initialize trailing-spaces len
           inspect function reverse (text-string)
           tallying trailing-spaces for leading space
               len for characters after space
           call "pangram" using pangram-flag len text-string
           cancel "pangram"
           if is-pangram
               display "is a pangram"
           else
               display "is not a pangram"
           end-if
           stop run
           .
       end program pan-test.

       identification division.
       program-id. pangram.
       data division.
       1 lc-alphabet pic x(26) value "abcdefghijklmnopqrstuvwxyz".
       linkage section.
       1 pangram-flag pic x.
        88 is-not-pangram value "n".
        88 is-pangram value "y".
       1 len binary pic 9(4).
       1 text-string pic x(80).
       procedure division using pangram-flag len text-string.
       begin.
           inspect lc-alphabet converting
               function lower-case (text-string (1:len))
               to space
           if lc-alphabet = space
               set is-pangram to true
           end-if
           exit program
           .
       end program pangram.

CoffeeScript

is_pangram = (s) ->
  # This is optimized for longish strings--as soon as all 26 letters
  # are encountered, we will be done.  Our worst case scenario is a really
  # long non-pangram, or a really long pangram with at least one letter
  # only appearing toward the end of the string.
  a_code = 'a'.charCodeAt(0)
  required_letters = {}
  for i in [a_code...a_code+26]
    required_letters[String.fromCharCode(i)] = true

  cnt = 0
  for c in s
    c = c.toLowerCase()
    if required_letters[c]
      cnt += 1
      return true if cnt == 26
      delete required_letters[c]
  false

do ->
  tests = [
    ["is this a pangram", false]
    ["The quick brown fox jumps over the lazy dog", true]
  ]

  for test in tests
    [s, exp_value] = test
    throw Error("fail") if is_pangram(s) != exp_value
    # try long strings
    long_str = ''
    for i in [1..500000]
      long_str += s
    throw Error("fail") if is_pangram(long_str) != exp_value
    console.log "Passed tests: #{s}"

Comal

0010 FUNC pangram#(s$) CLOSED
0020   FOR i#:=ORD("A") TO ORD("Z") DO
0030     IF NOT (CHR$(i#) IN s$ OR CHR$(i#+32) IN s$) THEN RETURN FALSE
0040   ENDFOR i#
0050   RETURN TRUE
0060 ENDFUNC
0070 //
0080 WHILE NOT EOD DO
0090   READ s$
0100   PRINT "'",s$,"' is ",
0110   IF NOT pangram#(s$) THEN PRINT "not ",
0120   PRINT "a pangram"
0130 ENDWHILE
0140 END
0150 DATA "The quick brown fox jumps over the lazy dog."
0160 DATA "The five boxing wizards dump quickly."
Output:
'The quick brown fox jumps over the lazy dog.' is a pangram
'The five boxing wizards dump quickly.' is not a pangram

Common Lisp

(defun pangramp (s)
  (null (set-difference
          (loop for c from (char-code #\A) upto (char-code #\Z) collect (code-char c))
          (coerce (string-upcase s) 'list))))

Component Pascal

BlackBox Component Builder

MODULE BbtPangramChecker;
IMPORT StdLog,DevCommanders,TextMappers;

PROCEDURE Check(str: ARRAY OF CHAR): BOOLEAN;
CONST
	letters = 26;
VAR
	i,j: INTEGER;
	status: ARRAY letters OF BOOLEAN;
	resp : BOOLEAN;
BEGIN
	FOR i := 0 TO LEN(status) -1 DO status[i] := FALSE END;

	FOR i := 0 TO LEN(str) -  1 DO
		j := ORD(CAP(str[i])) - ORD('A');
		IF (0 <= j) & (25 >= j) & ~status[j] THEN status[j] := TRUE END
	END;

	resp := TRUE;
	FOR i := 0 TO LEN(status) - 1 DO;
		resp := resp & status[i]
	END;
	RETURN resp;
END Check;

PROCEDURE Do*;
VAR
	params: DevCommanders.Par;
	s: TextMappers.Scanner;
BEGIN
	params := DevCommanders.par;
	s.ConnectTo(params.text);
	s.SetPos(params.beg);
	s.Scan;
	WHILE (~s.rider.eot) DO
		IF (s.type = TextMappers.char) & (s.char = '~') THEN
			RETURN
		ELSIF (s.type # TextMappers.string) THEN
			StdLog.String("Invalid parameter");StdLog.Ln
		ELSE
			StdLog.Char("'");StdLog.String(s.string + "' is pangram?:> ");
			StdLog.Bool(Check(s.string));StdLog.Ln
		END;
		s.Scan
	END
END Do;

END BbtPangramChecker.

Execute: ^Q BbtPangramChecker.Do "The quick brown fox jumps over the lazy dog"~
^Q BbtPangramChecker.Do "abcdefghijklmnopqrstuvwxyz"~
^Q BbtPangramChecker.Do "A simple text"~

Output:
'The quick brown fox jumps over the lazy dog' is pangram?:>  $TRUE
'abcdefghijklmnopqrstuvwxyz' is pangram?:>  $TRUE
'A simple text' is pangram?:>  $FALSE

Cowgol

include "cowgol.coh";

sub pangram(str: [uint8]): (r: uint8) is
    var letters: uint8[26];
    MemZero(&letters[0], 26);

    loop
        var chr := [str];
        if chr == 0 then break; end if;
        str := @next str;
        chr := (chr | 32) - 'a';
        if chr >= 26 then continue; end if;
        letters[chr] := letters[chr] | 1;
    end loop;

    r := 1;
    chr := 0;
    while chr < 26 loop
        r := r & letters[chr];
        if r == 0 then break; end if;
        chr := chr + 1;
    end loop;
end sub;

var yesno: [uint8][] := {": no\n", ": yes\n"};
var test: [uint8][] := {
    "The quick brown fox jumps over the lazy dog.",
    "The five boxing wizards dump quickly."
};

var i: @indexof test := 0;
while i < @sizeof test loop
    print(test[i]);
    print(yesno[pangram(test[i])]);
    i := i + 1;
end loop;
Output:
The quick brown fox jumps over the lazy dog.: yes
The five boxing wizards dump quickly.: no

Crystal

Copied and modified from the Ruby version.

def pangram?(sentence)
  ('a'..'z').all? {|c| sentence.downcase.includes?(c) }
end

p pangram?("not a pangram")
p pangram?("The quick brown fox jumps over the lazy dog.")
false
true

D

ASCII Bitmask version

bool isPangram(in string text) pure nothrow @safe @nogc {
    uint bitset;

    foreach (immutable c; text) {
        if (c >= 'a' && c <= 'z')
            bitset |= (1u << (c - 'a'));
        else if (c >= 'A' && c <= 'Z')
            bitset |= (1u << (c - 'A'));
    }

    return bitset == 0b11_11111111_11111111_11111111;
}

void main() {
    assert("the quick brown fox jumps over the lazy dog".isPangram);
    assert(!"ABCDEFGHIJKLMNOPQSTUVWXYZ".isPangram);
    assert(!"ABCDEFGHIJKL.NOPQRSTUVWXYZ".isPangram);
    assert("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ".isPangram);
}

Unicode version

import std.string, std.traits, std.uni;

// Do not compile with -g (debug info).
enum Alphabet : dstring {
    DE = "abcdefghijklmnopqrstuvwxyzßäöü",
    EN = "abcdefghijklmnopqrstuvwxyz",
    SV = "abcdefghijklmnopqrstuvwxyzåäö"
}

bool isPangram(S)(in S s, dstring alpha = Alphabet.EN)
pure /*nothrow*/ if (isSomeString!S) {
    foreach (dchar c; alpha)
       if (indexOf(s, c) == -1 && indexOf(s, std.uni.toUpper(c)) == -1)
            return false;
    return true;
}

void main() {
    assert(isPangram("the quick brown fox jumps over the lazy dog".dup, Alphabet.EN));
    assert(isPangram("Falsches Üben von Xylophonmusik quält jeden größeren Zwerg"d, Alphabet.DE));
    assert(isPangram("Yxskaftbud, ge vår wczonmö iqhjälp"w, Alphabet.SV));
}

Delphi

program PangramChecker;

{$APPTYPE CONSOLE}

uses StrUtils;

function IsPangram(const aString: string): Boolean;
var
  c: char;
begin
  for c := 'a' to 'z' do
    if not ContainsText(aString, c) then
      Exit(False);

  Result := True;
end;

begin
  Writeln(IsPangram('The quick brown fox jumps over the lazy dog')); // true
  Writeln(IsPangram('Not a panagram')); // false
end.

Draco

proc nonrec pangram(*char s) bool:
    ulong letters;
    char c;
    byte b;
    byte A = pretend('a', byte);
    byte Z = pretend('z', byte);

    letters := 0L0;
    while
        c := s*;
        s := s + 1;
        c /= '\e'
    do
        b := pretend(c, byte) | 32;
        if b >= A and b <= Z then
            letters := letters | 0L1 << (b-A)
        fi
    od;
    letters = 0x3FFFFFF
corp

proc nonrec test(*char s) void:
    writeln("\"", s, "\": ",
            if pangram(s) then "yes" else "no" fi)
corp

proc nonrec main() void:
    test("The quick brown fox jumps over the lazy dog.");
    test("The five boxing wizards jump quickly.");
    test("Not a pangram")
corp
Output:
"The quick brown fox jumps over the lazy dog.": yes
"The five boxing wizards jump quickly.": yes
"Not a pangram": no

E

def isPangram(sentence :String) {
    return ("abcdefghijklmnopqrstuvwxyz".asSet() &! sentence.toLowerCase().asSet()).size() == 0
}

&! is the “but-not” or set difference operator.

EasyLang

func pangr s$ .
   len d[] 26
   for c$ in strchars s$
      c = strcode c$
      if c >= 97 and c <= 122
         c -= 32
      .
      if c >= 65 and c <= 91
         d[c - 64] = 1
      .
   .
   for h in d[]
      s += h
   .
   return s
.
repeat
   s$ = input
   until s$ = ""
   print s$
   if pangr s$ = 26
      print "  --> pangram"
   .
   print ""
.
input_data
This is a test.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumped over the lazy dog.
QwErTyUiOpAsDfGhJkLzXcVbNm

EDSAC order code

The program includes a test string (at the end). If the program is running in the EdsacPC simulator, the user can enter another string by storing it in a text file, making that file the active file, and clicking Reset. The string must be terminated by a blank row of tape (represented by '.' in EdsacPC).

 [Pangram checker for Rosetta Code.
  EDSAC program, Initial Orders 2.]

 [Outline: Make a table, one entry per 5-bit character code.
  Initialize entry for each letter to 1.
  When a letter is read, convert its entry to 0.]

 [Subroutine to read string from the input and
    store it with character codes in low 5 bits.
  String is terminated by blank row of tape, which is stored.
  Input: 0F holds address of string in address field (bits 1..11).
  21 locations; workspace: 4F]
            T   56 K
  GKA3FT17@AFA18@T7@I4FA4FUFS19@G12@S20@G16@T4FA7@A2FE4@T4FEFUFP8FPD

 [*************** Rosetta Code task ***************
  Subroutine to test whether string is a pangram.
  Input:  0F = address of string, characters in low 5 bits,
               terminated by blank row of tape.
  Output: 1F = (number of missing letters) - 1.
  87 memory locations; workspace 4F.]
            T   88 K
            G      K
            A    3 F  [make and plant link for return]
            T   48 @
       [Fill letter table with 1's.
        The code is a bit neater if we work backwards.]
            A   54 @  [index of last entry]
      [3]   A   51 @  [make T order for table entry]
            T    6 @  [plant in code]
            A   53 @  [acc := 1]
      [6]   T      F  [table entry := 1]
            A    6 @  [dec address in table]
            S    2 F
            S   51 @  [finished table?]
            E    3 @  [loop back if not]
       [Set non-letters to 0, except blank row := -1]
            T    4 F  [clear acc]
            T   66 @  [figures shift]
            T   70 @  [letters shift]
            T   73 @  [carriage return]
            T   75 @  [space]
            T   79 @  [line feed]
            S   53 @  [acc := -1]
            T   71 @  [blank row of tape]
       [Loop to read characters from string.
        Terminated by blank row of tape.
        Assume acc = 0 here.]
            A      F  [load address of string]
            A   49 @  [make order to read first char]
     [21]   T   22 @  [plant in code]
     [22]   A      F  [char to acc]
            L      D  [shift to address field]
            A   50 @  [make A order for this char in table]
            U   28 @  [plant in code]
            A   52 @  [convert to T order]
            T   31 @  [plant in code]
     [28]   A      F  [load table entry]
            G   35 @  [jump out if it's -1, i.e. blank row]
            T    4 F  [clear acc]
     [31]   T      F  [table entry := 0 to flag that letter is present]
            A   22 @  [inc address in input string]
            A    2 F
            G   21 @  [back to read next char]
       [Get total of table entries, again working backwards.
        The number of missing letters is (total + 1).]
     [35]   T    4 F  [clear acc]
            T    1 F  [initialize total := 0]
            A   54 @  [index of last entry]
     [38]   A   50 @  [make A order for table entry]
            T   41 @  [plant in code]
            A    1 F  [load total so far]
     [41]   A      F  [add table entry]
            T    1 F  [update total]
            A   41 @  [load A order]
            S    2 F  [dec address]
            S   50 @  [finished table?]
            E   38 @  [loop back if not]
            T    4 F  [clear acc before exit]
     [48]   E      F
  [Constants]
     [49]   A      F  [to make A order referring to input]
     [50]   A   55 @  [to make A order referring to table]
     [51]   T   55 @  [to make T order referring to table]
     [52]   O      F  [add to A order to convert to T order]
     [53]   P      D  [constant 1]
     [54]   P   31 F  [to change address by 31]
  [Table]
     [55]   PFPFPFPFPFPFPFPFPFPFPF
     [66]   PFPFPFPF               [11 = figures shift]
     [70]   PF                     [15 = letters shift]
     [71]   PFPF                   [16 = blank row of tape]
     [73]   PFPF                   [18 = carriage return]
     [75]   PFPFPFPF               [20 = space]
     [79]   PFPFPFPFPFPFPFPF       [24 = line feed]

 [Main routine to demonstrate pangram-checking subroutine]
            T  200 K
            G      K
  [Constants]
      [0]   P   25 @  [address for input string]
      [1]   N      F  [letter N]
      [2]   Y      F  [letter Y]
      [3]   K 2048 F  [letter shift]
      [4]   @      F  [carriage return]
      [5]   &      F  [line feed]
      [6]   K 4096 F  [null char]
 [Enter with acc = 0]
      [7]   O    3 @  [set letters shift]
      [8]   A      @  [load address of input]
            T      F  [pass to input subroutine in 0F]
     [10]   A   10 @  [call input subroutine, doesn't change 0F]
            G   56 F
     [12]   A   12 @  [call pangram subroutine]
            G   88 F
       [We could print the number of missing letters,
        but we'll just print 'Y' or 'N'.]
            A    1 F  [load (number missing) - 1]
            E   18 @  [jump if not pangram]
            O    2 @  [print 'Y']
            G   19 @  [exit]
     [18]   O    1 @  [print 'N']
     [19]   O    4 @  [print CR, LF]
            O    5 @
            O    6 @  [print null to flush printer buffer]
            Z      F  [stop]
            T      F  [on Reset, clear acc]
            E    8 @  [and test another string]
     [25]             [input string goes here]
            E    7 Z  [define entry point]
            P      F  [acc = 0 on entry]
THE!QUICK!BROWN!FOX!JUMPS!OVER!THE!LAZY!DOG.
Output:
Y

Elixir

defmodule Pangram do
  def checker(str) do
    unused = Enum.to_list(?a..?z) -- to_char_list(String.downcase(str))
    Enum.empty?(unused)
  end
end

text = "The quick brown fox jumps over the lazy dog."
IO.puts "#{Pangram.checker(text)}\t#{text}"
text = (Enum.to_list(?A..?Z) -- 'Test') |> to_string
IO.puts "#{Pangram.checker(text)}\t#{text}"
Output:
true    The quick brown fox jumps over the lazy dog.
false   ABCDEFGHIJKLMNOPQRSUVWXYZ

Erlang

-module(pangram).
-export([is_pangram/1]).

is_pangram(String) ->
  ordsets:is_subset(lists:seq($a, $z), ordsets:from_list(string:to_lower(String))).

Excel

LAMBDA

With the following lambda bound to the name ISPANGRAM in the Excel Workbook Name Manager:

(See LAMBDA: The ultimate Excel worksheet function)

ISPANGRAM
=LAMBDA(s,
    LET(
        abc, CHARS(LOWER("abcdefghijklmnopqrstuvwxyz")),
        AND(
            LAMBDA(c,
                ISNUMBER(SEARCH(c, s, 1))
            )(
                abc
            )
        )
    )
)

And assuming that the name CHARS is also bound in the Name Manager

to the generic (String -> Array Char) lambda:

CHARS
=LAMBDA(s,
    MID(s, ROW(INDIRECT("1:" & LEN(s))), 1)
)
Output:
fx =ISPANGRAM(A2)
A B
1 Test strings Verdicts
2 The quick brown fox jumps over the lazy dog TRUE
3 Is this a pangram FALSE
4 How vexingly quick daft zebras jump! TRUE
5 The five boxing wizards jumped quickly. TRUE


F#

If the difference between the set of letters in the alphabet and the set of letters in the given string (after conversion to lower case) is the empty set then every letter appears somewhere in the given string:

let isPangram (str: string) = (set['a'..'z'] - set(str.ToLower())).IsEmpty

Factor

Translation of: E
: pangram? ( str -- ? )
    [ "abcdefghijklmnopqrstuvwxyz" ] dip >lower diff length 0 = ;

"How razorback-jumping frogs can level six piqued gymnasts!" pangram? .

Forth

: pangram? ( addr len -- ? )
  0 -rot bounds do
    i c@ 32 or [char] a -
    dup 0 26 within if
      1 swap lshift or
    else drop then
  loop
  1 26 lshift 1- = ;

s" The five boxing wizards jump quickly." pangram? .   \ -1

Fortran

Works with: Fortran version 90 and later
module pangram

  implicit none
  private
  public :: is_pangram
  character (*), parameter :: lower_case = 'abcdefghijklmnopqrstuvwxyz'
  character (*), parameter :: upper_case = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

contains

  function to_lower_case (input) result (output)

    implicit none
    character (*), intent (in) :: input
    character (len (input)) :: output
    integer :: i
    integer :: j

    output = input
    do i = 1, len (output)
      j = index (upper_case, output (i : i))
      if (j /= 0) then
        output (i : i) = lower_case (j : j)
      end if
    end do

  end function to_lower_case

  function is_pangram (input) result (output)

    implicit none
    character (*), intent (in) :: input
    character (len (input)) :: lower_case_input
    logical :: output
    integer :: i

    lower_case_input = to_lower_case (input)
    output = .true.
    do i = 1, len (lower_case)
      if (index (lower_case_input, lower_case (i : i)) == 0) then
        output = .false.
        exit
      end if
    end do

  end function is_pangram

end module pangram

Example:

program test

  use pangram, only: is_pangram

  implicit none
  character (256) :: string

  string = 'This is a sentence.'
  write (*, '(a)') trim (string)
  write (*, '(l1)') is_pangram (string)
  string = 'The five boxing wizards jumped quickly.'
  write (*, '(a)') trim (string)
  write (*, '(l1)') is_pangram (string)

end program test
Output:
This is a sentence.
F
The five boxing wizards jumped quickly.
T

Frink

s = "The quick brown fox jumps over the lazy dog."
println["\"$s\" is" + (isPangram[s] ? "" : " not") + " a pangram."]

isPangram[s] :=
{
   charSet = toSet[charList[lc[s]]]
   for c = "a" to "z"
      if ! charSet.contains[c]
         return false

   return true
}
Output:
"The quick brown fox jumps over the lazy dog." is a pangram.


FutureBasic

include "NSLog.incl"

local fn IsPangram( pangramString as CFStringRef ) as BOOL
  NSUInteger  i, count
  BOOL        result
  
  CFStringRef   lcPanStr = fn StringLowerCaseString( pangramString )
  CFMutableSetRef mutSet = fn MutableSetWithCapacity( 0 )
  
  count = len(lcPanStr)
  for i = 0 to count - 1
    if ( fn CharacterSetCharacterIsMember( fn CharacterSetLowercaseLetterSet, fn StringCharacterAtIndex( lcPanStr, i ) ) )
      MutableSetAddObject( mutSet, fn StringWithFormat( @"%c", fn StringCharacterAtIndex( lcPanStr, i ) ) )
    end if
  next
  if fn SetCount( mutSet ) >= 26 then result = YES else result = NO
end fn = result


CFStringRef testStr, trueStr, falseStr
CFArrayRef  array

trueStr  = @"Is a pangram"
falseStr = @"Not a pangram"

array = @[¬
@"My dog has fleas.",¬
@"The quick brown fox jumps over the lazy do.",¬
@"The quick brown fox jumped over the lazy dog.",¬
@"The quick brown fox jumps over the lazy dog.",¬
@"Jackdaws love my big sphinx of quartz.",¬
@"What's a jackdaw?",¬
@"Watch \"Jeopardy!\", Alex Trebek's fun TV quiz game.",¬
@"Pack my box with five dozen liquor jugs.",¬
@"This definitely is not a pangram.",¬
@"This is a random long sentence just for testing purposes."]

for testStr in array
  if ( fn IsPangram( testStr ) )
    NSLog( @"%13s : %@", fn StringUTF8String( trueStr ), testStr ) else NSLog( @"%s : %@", fn StringUTF8String( falseStr ), testStr )
  end if
next

HandleEvents
Output:
Not a pangram : My dog has fleas.
Not a pangram : The quick brown fox jumps over the lazy do.
Not a pangram : The quick brown fox jumped over the lazy dog.
 Is a pangram : The quick brown fox jumps over the lazy dog.
 Is a pangram : Jackdaws love my big sphinx of quartz.
Not a pangram : What's a jackdaw?
 Is a pangram : Watch "Jeopardy!", Alex Trebek's fun TV quiz game.
 Is a pangram : Pack my box with five dozen liquor jugs.
Not a pangram : This definitely is not a pangram.
Not a pangram : This is a random long sentence just for testing purposes.



Fōrmulæ

Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text. Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation —i.e. XML, JSON— they are intended for storage and transfer purposes more than visualization and edition.

Programs in Fōrmulæ are created/edited online in its website.

In this page you can see and run the program(s) related to this task and their results. You can also change either the programs or the parameters they are called with, for experimentation, but remember that these programs were created with the main purpose of showing a clear solution of the task, and they generally lack any kind of validation.

Solution

Test cases

Go

package main

import "fmt"

func main() {
    for _, s := range []string{
        "The quick brown fox jumps over the lazy dog.",
        `Watch "Jeopardy!", Alex Trebek's fun TV quiz game.`,
        "Not a pangram.",
    } {
        if pangram(s) {
            fmt.Println("Yes:", s)
        } else {
            fmt.Println("No: ", s)
        }
    }
}

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

		missing &^= 1 << index
		if missing == 0 {
			return true
		}
	}
	return false
}
Output:
Yes: The quick brown fox jumps over the lazy dog.
Yes: Watch "Jeopardy!", Alex Trebek's fun TV quiz game.
No:  Not a pangram.

Haskell

import Data.Char (toLower)
import Data.List ((\\))

pangram :: String -> Bool
pangram = null . (['a' .. 'z'] \\) . map toLower

main = print $ pangram "How razorback-jumping frogs can level six piqued gymnasts!"

HicEst

PangramBrokenAt("This is a Pangram.") ! => 2 (b is missing)
PangramBrokenAt("The quick Brown Fox jumps over the Lazy Dog") ! => 0 (OK)

FUNCTION PangramBrokenAt(string)
   CHARACTER string, Alfabet="abcdefghijklmnopqrstuvwxyz"
   PangramBrokenAt = INDEX(Alfabet, string, 64)
   ! option 64: verify = 1st letter of string not in Alfabet
END

Icon and Unicon

A panagram procedure:

procedure panagram(s)     #: return s if s is a panagram and fail otherwise
if (map(s) ** &lcase) === &lcase then return s
end

And a main to drive it:

procedure main(arglist)

if *arglist > 0 then
   every ( s := "" ) ||:= !arglist || " "
else
   s := "The quick brown fox jumps over the lazy dog."

writes(image(s), " -- is")
writes(if not panagram(s) then "n't")
write(" a panagram.")
end

Insitux

(function pangram? sentence
  (let prepped (-> sentence lower-case to-vec))
  (all? prepped (map char-code (range 97 123))))

(pangram? "The five boxing wizards jump quickly.")

Io

Sequence isPangram := method(
    letters := " " repeated(26)
    ia := "a" at(0)
    foreach(ichar,
        if(ichar isLetter,
            letters atPut((ichar asLowercase) - ia, ichar)
        )
    )
    letters contains(" " at(0)) not     // true only if no " " in letters
)

"The quick brown fox jumps over the lazy dog." isPangram println    // --> true
"The quick brown fox jumped over the lazy dog." isPangram println   // --> false
"ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ" isPangram println           // --> true

Ioke

Text isPangram? = method(
  letters = "abcdefghijklmnopqrstuvwxyz" chars
  text = self lower chars
  letters map(x, text include?(x)) reduce(&&)
)

Here is an example of it's use in the Ioke REPL:

iik> "The quick brown fox jumps over the lazy dog" isPangram?
"The quick brown fox jumps over the lazy dog" isPangram?
+> true

iik> "The quick brown fox jumps over the" isPangram?
"The quick brown fox jumps over the" isPangram?
+> false

J

Solution:

require 'strings'
isPangram=: (a. {~ 97+i.26) */@e. tolower

Example use:

   isPangram 'The quick brown fox jumps over the lazy dog.'
1
   isPangram 'The quick brown fox falls over the lazy dog.'
0

Java

Works with: Java version 1.5+
public class Pangram {
    public static boolean isPangram(String test){
        for (char a = 'A'; a <= 'Z'; a++)
            if ((test.indexOf(a) < 0) && (test.indexOf((char)(a + 32)) < 0))
                return false;
        return true;
    }

    public static void main(String[] args){
        System.out.println(isPangram("the quick brown fox jumps over the lazy dog"));//true
        System.out.println(isPangram("the quick brown fox jumped over the lazy dog"));//false, no s
        System.out.println(isPangram("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));//true
        System.out.println(isPangram("ABCDEFGHIJKLMNOPQSTUVWXYZ"));//false, no r
        System.out.println(isPangram("ABCDEFGHIJKL.NOPQRSTUVWXYZ"));//false, no m
        System.out.println(isPangram("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ"));//true
        System.out.println(isPangram(""));//false
    }
}
Output:
true
false
true
false
false
true
false

JavaScript

ES5

Iterative

function isPangram(s) {
    var letters = "zqxjkvbpygfwmucldrhsnioate"
    // sorted by frequency ascending (http://en.wikipedia.org/wiki/Letter_frequency)
    s = s.toLowerCase().replace(/[^a-z]/g,'')
    for (var i = 0; i < 26; i++)
        if (s.indexOf(letters[i]) < 0) return false
    return true
}

console.log(isPangram("is this a pangram"))  // false
console.log(isPangram("The quick brown fox jumps over the lazy dog"))  // true

ES6

Functional

(() => {
    "use strict";

    // ----------------- PANGRAM CHECKER -----------------

    // isPangram :: String -> Bool
    const isPangram = s =>
        0 === "abcdefghijklmnopqrstuvwxyz"
        .split("")
        .filter(c => -1 === s.toLowerCase().indexOf(c))
        .length;

    // ---------------------- TEST -----------------------
    return [
        "is this a pangram",
        "The quick brown fox jumps over the lazy dog"
    ].map(isPangram);
})();
Output:
[false, true]

jq

def is_pangram:
  explode
  | map( if 65 <= . and . <= 90 then . + 32 # uppercase
         elif 97 <= . and . <= 122 then .   # lowercase
         else empty
         end )
  | unique
  | length == 26;

# Example:
"The quick brown fox jumps over the lazy dog" | is_pangram
Output:
$ jq -M -n -f pangram.jq
true

Julia

makepangramchecker creates a function to test for pangramity based upon the contents of its input string, allowing one to create arbitrary pangram checkers.

function makepangramchecker(alphabet)
    alphabet = Set(uppercase.(alphabet))
    function ispangram(s)
        lengthcheck = length(s)  length(alphabet)
        return lengthcheck && all(c in uppercase(s) for c in alphabet)
    end
    return ispangram
end

const tests = ["Pack my box with five dozen liquor jugs.",
                "The quick brown fox jumps over a lazy dog.",
                "The quick brown fox jumps\u2323over the lazy dog.",
                "The five boxing wizards jump quickly.",
                "This sentence contains A-Z but not the whole alphabet."]

is_english_pangram = makepangramchecker('a':'z')

for s in tests
    println("The sentence \"", s, "\" is ", is_english_pangram(s) ? "" : "not ", "a pangram.")
end
Output:
The sentence "Pack my box with five dozen liquor jugs." is a pangram.
The sentence "The quick brown fox jumps over a lazy dog." is a pangram.
The sentence "The quick brown fox jumps⌣over the lazy dog." is a pangram.
The sentence "The five boxing wizards jump quickly." is a pangram.
The sentence "This sentence contains A-Z but not the whole alphabet." is not a pangram.

K

Works with: Kona
lcase   : _ci 97+!26
ucase   : _ci 65+!26
tolower : {@[x;p;:;lcase@n@p:&26>n:ucase?/:x]}
panagram: {&/lcase _lin tolower x}

Example:

  panagram "The quick brown fox jumps over the lazy dog"
1
  panagram "Panagram test"
0
Works with: ngn/k
isPangram:0=#(`c$"a"+!26)^_:

isPangram"This is a test"
0
isPangram"The quick brown fox jumps over the lazy dog."
1

Kotlin

// version 1.0.6

fun isPangram(s: String): Boolean {
    if (s.length < 26) return false
    val t = s.toLowerCase()
    for (c in 'a' .. 'z')
        if (c !in t) return false
    return true
}

fun main(args: Array<String>) {
   val candidates = arrayOf(
       "The quick brown fox jumps over the lazy dog",
       "New job: fix Mr. Gluck's hazy TV, PDQ!",
       "A very bad quack might jinx zippy fowls",
       "A very mad quack might jinx zippy fowls"   // no 'b' now!
   )
   for (candidate in candidates)
       println("'$candidate' is ${if (isPangram(candidate)) "a" else "not a"} pangram")
}
Output:
'The quick brown fox jumps over the lazy dog' is a pangram
'New job: fix Mr. Gluck's hazy TV, PDQ!' is a pangram
'A very bad quack might jinx zippy fowls' is a pangram
'A very mad quack might jinx zippy fowls' is not a pangram

Ksh

#!/bin/ksh

# Pangram checker

#	# Variables:
#
alphabet='abcdefghijklmnopqrstuvwxyz'

typeset -a strs
strs+=( 'Mr. Jock, TV quiz PhD., bags few lynx.' )
strs+=( 'A very mad quack might jinx zippy fowls.' )

#	# Functions:
#

#	# Function _ispangram(str) - return 0 if str is a pangram
#
function _ispangram {
	typeset _str ; typeset -l _str="$1"
	typeset _buff ; _buff="${alphabet}"
	typeset _i ; typeset -si _i

	for ((_i=0; _i<${#_str} && ${#_buff}>0; _i++)); do
		_buff=${_buff/${_str:${_i}:1}/}
	done
	return ${#_buff}
}

 ######
# main #
 ######

typeset -si i
for ((i=0; i<${#strs[*]}; i++)); do
	_ispangram "${strs[i]}"
	if (( ! $? )); then
		print "${strs[i]}   <<< IS A PANGRAM."
	else
		print "${strs[i]} <<< Is not a pangram."
	fi
done
Output:

Mr. Jock, TV quiz PhD., bags few lynx. <<< IS A PANGRAM. A very mad quack might jinx zippy fowls. <<< Is not a pangram.

to remove.all :s :set
  if empty? :s [output :set]
  if word? :s [output remove.all butfirst :s remove first :s :set]
  output remove.all butfirst :s remove.all first :s :set
end
to pangram? :s
  output empty? remove.all :s "abcdefghijklmnopqrstuvwxyz
end

show pangram? [The five boxing wizards jump quickly.]   ; true

Lua

require"lpeg"
S, C = lpeg.S, lpeg.C
function ispangram(s)
  return #(C(S(s)^0):match"abcdefghijklmnopqrstuvwxyz") == 26
end

print(ispangram"waltz, bad nymph, for quick jigs vex")
print(ispangram"bobby")
print(ispangram"long sentence")

Maple

#Used built-in StringTools package
is_pangram := proc(str)
	local present := StringTools:-LowerCase~(select(StringTools:-HasAlpha, StringTools:-Explode(str)));
	local alphabets := {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	present := convert(present, set);
	return evalb(present = alphabets);
end proc;
Usage:
is_pangram("The quick brown fox jumps over the lazy dog.");
is_pangram("The 2 QUIck brown foxes jumped over the lazy DOG!!");
is_pangram(""The quick brown fox jumps over the lay dog.");
Output:
true
true
false

Mathematica/Wolfram Language

pangramQ[msg_]:=Complement[CharacterRange["a", "z"], Characters[ToLowerCase[msg]]]=== {}

Usage:

pangramQ["The quick brown fox jumps over the lazy dog."]
True

Or a slightly more verbose version that outputs the missing characters if the string is not a pangram:

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]]]]

Usage:

pangramQ["The quick brown fox jumps over the lazy dog."]
The string is a pangram!
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}

MATLAB

function trueFalse = isPangram(string)

    %This works by histogramming the ascii character codes for lower case
    %letters contained in the string (which is first converted to all
    %lower case letters). Then it finds the index of the first letter that
    %is not contained in the string (this is faster than using the find
    %without the second parameter). If the find returns an empty array then
    %the original string is a pangram, if not then it isn't.

    trueFalse = isempty(find( histc(lower(string),(97:122))==0,1 ));

end
Output:
isPangram('The quick brown fox jumps over the lazy dog.')

ans =

     1

MATLAB / Octave

function trueFalse = isPangram(string)
    % X is a histogram of letters
    X = sparse(abs(lower(string)),1,1,128,1);
    trueFalse = full(all(X('a':'z') > 0));
end
Output:
>>isPangram('The quick brown fox jumps over the lazy dog.')
ans = 1

min

Works with: min version 0.19.3
"abcdefghijklmnopqrstuvwxyz" "" split =alphabet
('alphabet dip lowercase (swap match) prepend all?) :pangram?

"The quick brown fox jumps over the lazy dog." pangram? puts

MiniScript

sentences = ["The quick brown fox jumps over the lazy dog.",
    "Peter Piper picked a peck of pickled peppers.",
    "Waltz job vexed quick frog nymphs."]

alphabet = "abcdefghijklmnopqrstuvwxyz"

pangram = function (toCheck)
    sentence = toCheck.lower
    fail = false
    for c in alphabet
        if sentence.indexOf(c) == null then return false
    end for
    return true
end function

for sentence in sentences
    if pangram(sentence) then
        print """" + sentence + """ is a Pangram"
    else
        print """" + sentence + """ is not a Pangram"
    end if
end for
Output:
"The quick brown fox jumps over the lazy dog." is a Pangram
"Peter Piper picked a peck of pickled peppers." is not a Pangram
"Waltz job vexed quick frog nymphs." is a Pangram

ML

mLite

fun to_locase s = implode ` map (c_downcase) ` explode s

fun is_pangram
	(h :: t, T) =
		let
			val flen = len (filter (fn c = c eql h) T)
		in
			if (flen = 0) then
				false
			else
				is_pangram (t, T)
		end
|	([], T) = true
| 	S = is_pangram (explode "abcdefghijklmnopqrstuvwxyz", explode ` to_locase S)

fun is_pangram_i
	(h :: t, T) =
		let
			val flen = len (filter (fn c = c eql h) T)
		in
			if (flen = 0) then
				false
			else
				is_pangram (t, T)
		end
|	([], T) = true
| 	(A,S) = is_pangram (explode A, explode ` to_locase S)

fun test (f, arg, res, ok, notok) = if (f arg eql res) then ("'" @ arg @ "' " @ ok) else ("'" @ arg @ "' " @ notok)
fun test2 (f, arg, res, ok, notok) = if (f arg eql res) then ("'" @ ref (arg,1) @ "' " @ ok) else ("'" @ ref (arg,1) @ "' " @ notok)

;
println ` test (is_pangram, "The quick brown fox jumps over the lazy dog", true, "is a pangram", "is not a pangram");
println ` test (is_pangram, "abcdefghijklopqrstuvwxyz", true, "is a pangram", "is not a pangram");
val SValphabet = "abcdefghijklmnopqrstuvwxyzåäö";
val SVsentence = "Yxskaftbud, ge vår wczonmö iq hjälp";
println ` test2 (is_pangram_i, (SValphabet, SVsentence), true, "is a Swedish pangram", "is not a Swedish pangram");
Output:
'The quick brown fox jumps over the lazy dog' is a pangram
'abcdefghijklopqrstuvwxyz' is not a pangram
'Yxskaftbud, ge vår wczonmö iq hjälp' is a Swedish pangram

Modula-2

MODULE Pangrams;
FROM InOut IMPORT WriteString, WriteLn;
FROM Strings IMPORT Length;

(* Check if a string is a pangram *)
PROCEDURE pangram(s: ARRAY OF CHAR): BOOLEAN;
    VAR letters: ARRAY [0..25] OF BOOLEAN;
        i: CARDINAL;
BEGIN
    FOR i := 0 TO 25 DO letters[i] := FALSE; END;
    FOR i := 0 TO Length(s)-1 DO
        IF (s[i] >= 'A') AND (s[i] <= 'Z') THEN
            letters[ORD(s[i]) - ORD('A')] := TRUE;
        ELSIF (s[i] >= 'a') AND (s[i] <= 'z') THEN
            letters[ORD(s[i]) - ORD('a')] := TRUE;
        END;
    END;
    FOR i := 0 TO 25 DO
        IF NOT letters[i] THEN
            RETURN FALSE;
        END;
    END;
    RETURN TRUE;
END pangram;

PROCEDURE example(s: ARRAY OF CHAR);
BEGIN
    WriteString("'");
    WriteString(s);
    WriteString("' is ");
    IF NOT pangram(s) THEN
        WriteString("not ");
    END;
    WriteString("a pangram.");
    WriteLn();
END example;

BEGIN
    example("The quick brown fox jumps over the lazy dog");
    example("The five boxing wizards dump quickly");
    example("abcdefghijklmnopqrstuvwxyz");
END Pangrams.
Output:
'The quick brown fox jumps over the lazy dog' is a pangram.
'The five boxing wizards dump quickly' is not a pangram.
'abcdefghijklmnopqrstuvwxyz' is a pangram.

NetRexx

NetRexx's verify built–in method is all you need!

/* NetRexx */
options replace format comments java crossref savelog symbols nobinary

A2Z = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

pangrams = create_samples

loop p_ = 1 to pangrams[0]
  pangram = pangrams[p_]
  q_ = A2Z.verify(pangram.upper) -- <= it basically all happens in this function call!
  say pangram.left(64)'\-'
  if q_ == 0 then -
    say ' [OK, a pangram]'
  else -
    say ' [Not a pangram.  Missing:' A2Z.substr(q_, 1)']'
  end p_

method create_samples public static returns Rexx

  pangrams = ''

  x_ = 0
  x_ = x_ + 1; pangrams[0] = x_; pangrams[x_] = 'The quick brown fox jumps over a lazy dog.'    -- best/shortest pangram
  x_ = x_ + 1; pangrams[0] = x_; pangrams[x_] = 'The quick brown fox jumps over the lazy dog.'  -- not as short but at least it's still a pangram
  x_ = x_ + 1; pangrams[0] = x_; pangrams[x_] = 'The quick brown fox jumped over the lazy dog.' -- common misquote; not a pangram
  x_ = x_ + 1; pangrams[0] = x_; pangrams[x_] = 'The quick onyx goblin jumps over the lazy dwarf.'
  x_ = x_ + 1; pangrams[0] = x_; pangrams[x_] = 'Bored? Craving a pub quiz fix? Why, just come to the Royal Oak!' -- (Used to advertise a pub quiz in Bowness-on-Windermere)

  return pangrams
Output:
The quick brown fox jumps over a lazy dog.                       [OK, a pangram]
The quick brown fox jumps over the lazy dog.                     [OK, a pangram]
The quick brown fox jumped over the lazy dog.                    [Not a pangram.  Missing: S]
The quick onyx goblin jumps over the lazy dwarf.                 [OK, a pangram]
Bored? Craving a pub quiz fix? Why, just come to the Royal Oak!  [OK, a pangram]

NewLISP

(context 'PGR)                              ;; Switch to context (say namespace) PGR
(define (is-pangram? str)
    (setf chars (explode (upper-case str))) ;; Uppercase + convert string into a list of chars
    (setf is-pangram-status true)           ;; Default return value of function
    (for (c (char "A") (char "Z") 1 (nil? is-pangram-status)) ;; For loop with break condition
        (if (not (find (char c) chars))     ;; If char not found in list, "is-pangram-status" becomes "nil"
            (setf is-pangram-status nil)
        )
    )
    is-pangram-status                       ;; Return current value of symbol "is-pangram-status"
)
(context 'MAIN)                             ;; Back to MAIN context

;; - - - - - - - - - -

(println (PGR:is-pangram? "abcdefghijklmnopqrstuvwxyz"))  ;; Print true
(println (PGR:is-pangram? "abcdef"))  ;; Print nil
(exit)

Nim

import rdstdin

proc isPangram(sentence: string, alphabet = {'a'..'z'}): bool =
  var sentset: set[char] = {}
  for c in sentence: sentset.incl c
  alphabet <= sentset

echo isPangram(readLineFromStdin "Sentence: ")

Example usage:

Sentence: The quick brown fox jumps over the lazy dog
true

Objeck

Translation of: Java
bundle Default {
  class Pangram {
    function : native : IsPangram(test : String) ~ Bool {
      for(a := 'A'; a <= 'Z'; a += 1;) {
        if(test->Find(a) < 0 & test->Find(a->ToLower()) < 0) {
          return false;
        };
      };

      return true;
    }

    function : Main(args : String[]) ~ Nil {
      IsPangram("the quick brown fox jumps over the lazy dog")->PrintLine(); # true
      IsPangram("the quick brown fox jumped over the lazy dog")->PrintLine(); # false, no s
      IsPangram("ABCDEFGHIJKLMNOPQRSTUVWXYZ")->PrintLine(); # true
      IsPangram("ABCDEFGHIJKLMNOPQSTUVWXYZ")->PrintLine(); # false, no r
      IsPangram("ABCDEFGHIJKL.NOPQRSTUVWXYZ")->PrintLine(); # false, no m
      IsPangram("ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ")->PrintLine(); # true
      IsPangram("")->PrintLine(); # false
    }
  }
}

OCaml

let pangram str =
  let ar = Array.make 26 false in
  String.iter (function
  | 'a'..'z' as c -> ar.(Char.code c - Char.code 'a') <- true
  | _ -> ()
  ) (String.lowercase str);
  Array.fold_left ( && ) true ar
let check str =
  Printf.printf " %b -- %s\n" (pangram str) str

let () =
  check "this is a sentence";
  check "The quick brown fox jumps over the lazy dog.";
;;
Output:
false -- this is a sentence
true -- The quick brown fox jumps over the lazy dog.

Oz

declare
  fun {IsPangram Xs}
     {List.sub
      {List.number &a &z 1}
      {Sort {Map Xs Char.toLower} Value.'<'}}
  end
in
  {Show {IsPangram "The quick brown fox jumps over the lazy dog."}}

PARI/GP

pangram(s)={
  s=vecsort(Vec(s),,8);
  for(i=97,122,
    if(!setsearch(s,Strchr(i)) && !setsearch(s,Strchr(i-32)),
      return(0)
    )
  );
  1
};

pangram("The quick brown fox jumps over the lazy dog.")
pangram("The quick brown fox jumps over the lazy doe.")

Pascal

See Delphi

Perl

Get an answer with a module, or without.

use strict;
use warnings;
use feature 'say';

sub pangram1 {
    my($str,@set) = @_;
    use List::MoreUtils 'all';
    all { $str =~ /$_/i } @set;
}

sub pangram2 {
    my($str,@set) = @_;
    '' eq (join '',@set) =~ s/[$str]//gir;
}

my @alpha = 'a' .. 'z';

for (
    'Cozy Lummox Gives Smart Squid Who Asks For Job Pen.',
    'Crabby Lummox Gives Smart Squid Who Asks For Job Pen.'
) {
    say pangram1($_,@alpha) ? 'Yes' : 'No';
    say pangram2($_,@alpha) ? 'Yes' : 'No';
}
Output:
Yes
Yes
No
No

Phix

function pangram(string s)
sequence az = repeat(false,26)
integer count = 0
    for i=1 to length(s) do
        integer ch = lower(s[i])
        if ch>='a'
        and ch<='z'
        and not az[ch-96] then
            count += 1
            if count=26 then return {true,0} end if
            az[ch-96] = true
        end if
    end for
    return {false,find(false,az)+96}
end function
sequence checks = {"The quick brown fox jumped over the lazy dog",
                   "The quick brown fox jumps over the lazy dog",
                   ".!$\"AbCdEfghijklmnoprqstuvwxyz",
                   "THE FIVE BOXING WIZARDS DUMP QUICKLY.",
                   "THE FIVE BOXING WIZARDS JUMP QUICKLY.",
                   "HEAVY BOXES PERFORM WALTZES AND JIGS.",
                   "PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.",
                   "Big fjiords vex quick waltz nymph",
                   "The quick onyx goblin jumps over the lazy dwarf.",
                   "no"}
for i=1 to length(checks) do
    string ci = checks[i]
    integer {r,ch} = pangram(ci)
    printf(1,"%-50s - %s\n",{ci,iff(r?"yes":"no "&ch)})
end for
Output:
The quick brown fox jumped over the lazy dog       - no s
The quick brown fox jumps over the lazy dog        - yes
.!$"AbCdEfghijklmnoprqstuvwxyz                     - yes
THE FIVE BOXING WIZARDS DUMP QUICKLY.              - no j
THE FIVE BOXING WIZARDS JUMP QUICKLY.              - yes
HEAVY BOXES PERFORM WALTZES AND JIGS.              - no c
PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.           - yes
Big fjiords vex quick waltz nymph                  - yes
The quick onyx goblin jumps over the lazy dwarf.   - yes
no                                                 - no a

Phixmonti

include ..\Utilitys.pmt

def pangram?
	lower "abcdefghijklmnopqrstuvwxyz" swap remove len not nip
enddef

"The quick brown fox jumps over the lazy dog." pangram?
"This is a test" pangram?
"NOPQRSTUVWXYZ  abcdefghijklm" pangram?
"abcdefghijklopqrstuvwxyz" pangram?

pstack
Output:
[1, 0, 1, 0]

=== Press any key to exit ===

PHP

Translation of: D
function isPangram($text) {
    foreach (str_split($text) as $c) {
        if ($c >= 'a' && $c <= 'z')
            $bitset |= (1 << (ord($c) - ord('a')));
        else if ($c >= 'A' && $c <= 'Z')
            $bitset |= (1 << (ord($c) - ord('A')));
    }
    return $bitset == 0x3ffffff;
}

$test = array(
    "the quick brown fox jumps over the lazy dog",
    "the quick brown fox jumped over the lazy dog",
    "ABCDEFGHIJKLMNOPQSTUVWXYZ",
    "ABCDEFGHIJKL.NOPQRSTUVWXYZ",
    "ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ"
);

foreach ($test as $str)
    echo "$str : ", isPangram($str) ? 'T' : 'F', '</br>';
the quick brown fox jumps over the lazy dog : T
the quick brown fox jumped over the lazy dog : F
ABCDEFGHIJKLMNOPQSTUVWXYZ : F
ABCDEFGHIJKL.NOPQRSTUVWXYZ : F
ABC.D.E.FGHI*J/KL-M+NO*PQ R STUVWXYZ : T

Using array

function is_pangram( $sentence ) {

    // define "alphabet"
    $alpha = range( 'a', 'z' );

    // split lowercased string into array
    $a_sentence = str_split( strtolower( $sentence ) );

    // check that there are no letters present in alpha not in sentence
    return empty( array_diff( $alpha, $a_sentence ) );

}

$tests = array(
    "The quick brown fox jumps over the lazy dog.",
    "The brown fox jumps over the lazy dog.",
    "ABCDEFGHIJKL.NOPQRSTUVWXYZ",
    "ABC.D.E.FGHI*J/KL-M+NO*PQ R\nSTUVWXYZ",
    "How vexingly quick daft zebras jump",
    "Is hotdog?",
    "How razorback-jumping frogs can level six piqued gymnasts!"
);

foreach ( $tests as $txt ) {
    echo '"', $txt, '"', PHP_EOL;
    echo is_pangram( $txt ) ? "Yes" : "No", PHP_EOL, PHP_EOL;
}
Output:
"The quick brown fox jumps over the lazy dog."
Yes

"The brown fox jumps over the lazy dog."
No

"ABCDEFGHIJKL.NOPQRSTUVWXYZ"
No

"ABC.D.E.FGHI*J/KL-M+NO*PQ R
STUVWXYZ"
Yes

"How vexingly quick daft zebras jump"
Yes

"Is hotdog?"
No

"How razorback-jumping frogs can level six piqued gymnasts!"
Yes

Picat

go =>
   S1 = "The quick brown fox jumps over the lazy dog",
   S2 = "The slow brown fox jumps over the lazy dog",
   println([S1, is_pangram(S1)]),
   println([S2, is_pangram(S2)]),
   nl,
   println("With missing chars:"),
   println([S1, is_pangram2(S1)]),
   println([S2, is_pangram2(S2)]),
   nl.

% Check if S is a pangram and get the missing chars
is_pangram(S) = P =>
   Lower = S.to_lowercase,
   Alpha = [chr(I+96) : I in 1..26],
   foreach(A in Alpha) membchk(A,Lower) end -> P = true ; P = false.

% Check if S is a pangram and get the missing chars (if any)
is_pangram2(S) = [pangram=cond(Missing==[],true,false),missing=Missing] =>
   Lower = S.to_lowercase,
   Missing = [A : A in [chr(I+96) : I in 1..26], not membchk(A,Lower)].
Output:
[The quick brown fox jumps over the lazy dog,true]
[The slow brown fox jumps over the lazy dog,false]

With missing chars:
[The quick brown fox jumps over the lazy dog,[pangram = true,missing = []]]
[The slow brown fox jumps over the lazy dog,[pangram = false,missing = cikq]]

PicoLisp

(de isPangram (Str)
   (not
      (diff
         '`(chop "abcdefghijklmnopqrstuvwxyz")
         (chop (lowc Str)) ) ) )

PL/I

test_pangram: procedure options (main);

is_pangram: procedure() returns (bit(1) aligned);

   declare text character (200) varying;
   declare c character (1);

   get edit (text) (L);
   put skip list (text);

   text = lowercase(text);

   do c = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
          'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
          'v', 'w', 'x', 'y', 'z';
      if index(text, c) = 0 then return ('0'b);
   end;
   return ('1'b);
end is_pangram;

   put skip list ('Please type a sentence');

   if is_pangram() then
      put skip list ('The sentence is a pangram.');
   else
      put skip list ('The sentence is not a pangram.');

end test_pangram;
Output:
Please type a sentence

the quick brown fox jumps over the lazy dog
The sentence is a pangram.

PowerShell

Cyrillic test sample borrowed from Raku.

Works with: PowerShell version 2
function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
    {
    $Text = $Text.ToLower()
    $Alphabet = $Alphabet.ToLower()

    $IsPangram = @( $Alphabet.ToCharArray() | Where-Object { $Text.Contains( $_ ) } ).Count -eq $Alphabet.Length

    return $IsPangram
    }

Test-Pangram 'The quick brown fox jumped over the lazy dog.'
Test-Pangram 'The quick brown fox jumps over the lazy dog.'
Test-Pangram 'Съешь же ещё этих мягких французских булок, да выпей чаю' 'абвгдежзийклмнопрстуфхцчшщъыьэюяё'
Output:
False
True
True

A faster version can be created using .Net HashSet to do what the F# version does:

Function Test-Pangram ( [string]$Text, [string]$Alphabet = 'abcdefghijklmnopqrstuvwxyz' )
{
    $alSet   = [Collections.Generic.HashSet[char]]::new($Alphabet.ToLower())
    $textSet = [Collections.Generic.HashSet[char]]::new($Text.ToLower())

    $alSet.ExceptWith($textSet)    # remove text chars from the alphabet

    return $alSet.Count -eq 0    # any alphabet letters still remaining?
}

Prolog

Works with SWI-Prolog

pangram(L) :-
	numlist(0'a, 0'z, Alphabet),
	forall(member(C, Alphabet), member(C, L)).

pangram_example :-
	L1 = "the quick brown fox jumps over the lazy dog",
	(   pangram(L1) -> R1= ok; R1 = ko),
	format('~s --> ~w ~n', [L1,R1]),

	L2 = "the quick brown fox jumped over the lazy dog",
	(   pangram(L2) -> R2 = ok; R2 = ko),
	format('~s --> ~w ~n', [L2, R2]).
Output:
?- pangram_example.
the quick brown fox jumps over the lazy dog --> ok
the quick brown fox jumped over the lazy dog --> ko
true.

Python

Using set arithmetic:

import string, sys
if sys.version_info[0] < 3:
    input = raw_input

def ispangram(sentence, alphabet=string.ascii_lowercase):
    alphaset = set(alphabet)
    return alphaset <= set(sentence.lower())

print ( ispangram(input('Sentence: ')) )
Output:
Sentence: The quick brown fox jumps over the lazy dog
True

Quackery

  [ dup char A char [ within
    swap char a char { within
    or ]                        is letter  ( c --> b )

  [ 0 26 of swap witheach
      [ dup letter iff
          [ 1 unrot lower
            char a - poke ]
        else drop ]
    0 swap find 26 = ]          is pangram ( $ --> b )

  $ "This is a sentence." pangram echo cr                     ( 0 )
  $ "The five boxing wizards jumped quickly." pangram echo cr ( 1 )

R

Using the built-in R vector "letters":

checkPangram <- function(sentence){
  my.letters <- tolower(unlist(strsplit(sentence, "")))
  is.pangram <- all(letters %in% my.letters)

  if (is.pangram){
    cat("\"", sentence, "\" is a pangram! \n", sep="")
  } else {
    cat("\"", sentence, "\" is not a pangram! \n", sep="")
  }
}
Output:
s1 <- "The quick brown fox jumps over the lazy dog"
s2 <- "The quick brown fox jumps over the sluggish dog"
checkPangram(s1)
"The quick brown fox jumps over the lazy dog" is a pangram!
checkPangram(s2)
"The quick brown fox jumps over the sluggish dog" is not a pangram!

Racket

#lang racket
(define (pangram? str)
  (define chars (regexp-replace* #rx"[^a-z]+" (string-downcase str) ""))
  (= 26 (length (remove-duplicates (string->list chars)))))
(pangram? "The quick Brown Fox jumps over the Lazy Dog")

Raku

(formerly Perl 6)

constant Eng = set 'a' .. 'z';
constant Cyr = (set 'а' .. 'ё') (-) (set 'ъ', 'ѐ');
constant Hex = set 'a' .. 'f';

sub pangram($str, Set $alpha = Eng) {
  $alpha$str.lc.comb
}

say pangram("The quick brown fox jumps over the lazy dog.");
say pangram("My dog has fleas.");
say pangram("My dog has fleas.", Hex);
say pangram("My dog backs fleas.", Hex);
say pangram "Съешь же ещё этих мягких французских булок, да выпей чаю", Cyr;
Output:
True
False
False
True
True

Retro

'abcdefghijklmnopqrstuvwxyz 'FULL s:const
'__________________________ 'TEST s:const
:s:pangram? (s-f)
  '__________________________ &TEST #26 copy
  s:to-lower [ c:letter? ] s:filter
  [ dup $a - &TEST + store ] s:for-each
  &TEST &FULL s:eq? ;

REXX

/*REXX program  verifies  if an  entered/supplied  string  (sentence)  is a pangram.    */
@abc= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'               /*a list of all (Latin) capital letters*/

    do forever;    say                           /*keep promoting 'til null (or blanks).*/
    say '──────── Please enter a pangramic sentence   (or a blank to quit):';      say
    pull y                                       /*this also uppercases the  Y variable.*/
    if y=''  then leave                          /*if nothing entered,  then we're done.*/
    absent= space( translate( @abc, , y), 0)     /*obtain a list of any absent letters. */
    if absent==''  then say  "──────── Sentence is a pangram."
                   else say  "──────── Sentence isn't a pangram, missing: "    absent
    say
    end   /*forever*/

say '──────── PANGRAM program ended. ────────'   /*stick a fork in it,  we're all done. */
output:
──────── Please enter a pangramic sentence   (or a blank to quit):
The quick brown fox jumped over the lazy dog.      ◄■■■■■■■■■■ user input.
──────── Sentence isn't a pangram, missing:  S


──────── Please enter a pangramic sentence   (or a blank to quit):
The quick brown fox JUMPS over the lazy dog!!!     ◄■■■■■■■■■■ user input.
──────── Sentence is a pangram.


──────── Please enter a pangramic sentence   (or a blank to quit):
                                                   ◄■■■■■■■■■■ user input   (null  or  some blanks).

──────── PANGRAM program ended. ────────

Ring

pangram = 0
s = "The quick brown fox jumps over the lazy dog."
see "" + pangram(s) + " " + s + nl

s = "My dog has fleas."
see "" + pangram(s) + " " + s + nl

func pangram str
     str  = lower(str)
     for i = ascii("a") to ascii("z")
             bool = substr(str, char(i)) > 0
             pangram = pangram + bool
     next
     pan = (pangram = 26)
     return pan

RPL

Structurally programmed

RPL code Comment
≪ 
  # 0h SWAP 1 OVER SIZE FOR j 
     DUP j DUP SUB NUM 
     IF DUP 97 ≥ OVER 122 ≤ AND THEN 32 - END
     IF DUP 65 ≥ OVER 90 ≤ AND THEN 
        2 SWAP 65 - ^ R→B ROT OR SWAP 
     ELSE DROP END 
  NEXT DROP # 3FFFFFFh ==
≫ ‘PANG?’ STO
PANG? ( "sentence" → boolean ) 
alpha = 0; loop for j = 1 to length(sentence)
  c = ascii(sentence[j])
  if c lowercase then make it uppercase
  if c in ("A".."Z") then
     alpha &= 2^(c-65)
end loop
return alpha & 3FFFFFFh

Idiomatically optimized for HP-28S

RPL code Comment
 ≪ 
  # 7FFFFFEh RCLF OVER NOT AND STOF SWAP 
   1 OVER SIZE FOR j 
     DUP j DUP SUB NUM 
     DUP 97 ≥ 95 63 IFTE - 1 MAX 28 MIN SF 
   NEXT DROP RCLF OVER AND == 
≫ ‘PANG?’ STO
PANG? ( "sentence" → boolean ) 
clear flags 1 to 28
loop for j = 1 to length(sentence)
  c = ascii(sentence[j])
  reduce c to a value between 1 and 28 and set related flag
  return 1 if all flags between 2 and 27 are set

To run on more recent models, the following sequence in line 2

RCLF OVER NOT AND STOF

must be replaced by

RCLF DUP 2 GET 3 PICK NOT AND 2 SWAP PUT STOF

and RCLF in the last line by RCLF 2 GET.

"The quick brown fox jumps over the lazy dog" PANG?
"The quick brown fox jumped over the lazy dog" PANG?
Output:
2: 1
1: 0

Ruby

def pangram?(sentence)
  s = sentence.downcase
  ('a'..'z').all? {|char| s.include? (char) }
end

p pangram?('this is a sentence')  # ==> false
p pangram?('The quick brown fox jumps over the lazy dog.')  # ==> true

Rust

#![feature(test)]

extern crate test;

use std::collections::HashSet;

pub fn is_pangram_via_bitmask(s: &str) -> bool {

    // Create a mask of set bits and convert to false as we find characters.
    let mut mask = (1 << 26) - 1;

    for chr in s.chars() {
        let val = chr as u32 & !0x20; /* 0x20 converts lowercase to upper */
        if val <= 'Z' as u32 && val >= 'A' as u32 {
            mask = mask & !(1 << (val - 'A' as u32));
        }
    }

    mask == 0
}

pub fn is_pangram_via_hashset(s: &str) -> bool {

    // Insert lowercase letters into a HashSet, then check if we have at least 26.
    let letters = s.chars()
        .flat_map(|chr| chr.to_lowercase())
        .filter(|&chr| chr >= 'a' && chr <= 'z')
        .fold(HashSet::new(), |mut letters, chr| {
            letters.insert(chr);
            letters
        });

    letters.len() == 26
}

pub fn is_pangram_via_sort(s: &str) -> bool {

    // Copy chars into a vector, convert to lowercase, sort, and remove duplicates.
    let mut chars: Vec<char> = s.chars()
        .flat_map(|chr| chr.to_lowercase())
        .filter(|&chr| chr >= 'a' && chr <= 'z')
        .collect();

    chars.sort();
    chars.dedup();

    chars.len() == 26
}

fn main() {

    let examples = ["The quick brown fox jumps over the lazy dog",
                    "The quick white cat jumps over the lazy dog"];

    for &text in examples.iter() {
        let is_pangram_sort = is_pangram_via_sort(text);
        println!("Is \"{}\" a pangram via sort? - {}", text, is_pangram_sort);

        let is_pangram_bitmask = is_pangram_via_bitmask(text);
        println!("Is \"{}\" a pangram via bitmask? - {}",
                 text,
                 is_pangram_bitmask);

        let is_pangram_hashset = is_pangram_via_hashset(text);
        println!("Is \"{}\" a pangram via bitmask? - {}",
                 text,
                 is_pangram_hashset);
    }
}

Scala

def is_pangram(sentence: String) = sentence.toLowerCase.filter(c => c >= 'a' && c <= 'z').toSet.size == 26
scala> is_pangram("This is a sentence")
res0: Boolean = false

scala> is_pangram("The quick brown fox jumps over the lazy dog")
res1: Boolean = true

Seed7

$ include "seed7_05.s7i";

const func boolean: isPangram (in string: stri) is func
  result
    var boolean: isPangram is FALSE;
  local
    var char: ch is ' ';
    var set of char: usedChars is (set of char).value;
  begin
    for ch range lower(stri) do
      if ch in {'a' .. 'z'} then
        incl(usedChars, ch);
      end if;
    end for;
    isPangram := usedChars = {'a' .. 'z'};
  end func;

const proc: main is func
  begin
    writeln(isPangram("This is a test"));
    writeln(isPangram("The quick brown fox jumps over the lazy dog"));
    writeln(isPangram("NOPQRSTUVWXYZ  abcdefghijklm"));
    writeln(isPangram("abcdefghijklopqrstuvwxyz"));  # Missing m, n
  end func;
Output:
FALSE
TRUE
TRUE
FALSE

Sidef

Translation of: Raku
define Eng = 'a'..'z';
define Hex = 'a'..'f';
define Cyr = %w(а б в г д е ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я ё);

func pangram(str, alpha=Eng) {
    var lstr = str.lc;
    alpha.all {|c| lstr.contains(c) };
}

say pangram("The quick brown fox jumps over the lazy dog.");
say pangram("My dog has fleas.");
say pangram("My dog has fleas.", Hex);
say pangram("My dog backs fleas.", Hex);
say pangram("Съешь же ещё этих мягких французских булок, да выпей чаю", Cyr);
Output:
true
false
false
true
true

Smalltalk

!String methodsFor: 'testing'!
isPangram
	^((self collect: [:c | c asUppercase]) select: [:c | c >= $A and: [c <= $Z]]) asSet size = 26
'The quick brown fox jumps over the lazy dog.' isPangram

SNOBOL4

Works with: Macro Spitbol
Works with: Snobol4+
Works with: CSnobol
        define('pangram(str)alfa,c') :(pangram_end)
pangram str = replace(str,&ucase,&lcase)
        alfa = &lcase
pgr_1   alfa len(1) . c = :f(return)
        str c :s(pgr_1)f(freturn)
pangram_end

        define('panchk(str)tf') :(panchk_end)
panchk  output = str
        tf = 'False'; tf = pangram(str) 'True'
        output = 'Pangram: ' tf :(return)
panchk_end

*       # Test and display
        panchk("The quick brown fox jumped over the lazy dogs.")
        panchk("My girl wove six dozen plaid jackets before she quit.")
        panchk("This 41-character string: it's a pangram!")
end
Output:
The quick brown fox jumped over the lazy dogs.
Pangram: True
My girl wove six dozen plaid jackets before she quit.
Pangram: True
This 41-character string: it's a pangram!
Pangram: False

Swift

import Foundation

let str = "the quick brown fox jumps over the lazy dog"

func isPangram(str:String) -> Bool {
    let stringArray = Array(str.lowercaseString)
    for char in "abcdefghijklmnopqrstuvwxyz" {
        if (find(stringArray, char) == nil) {
            return false
        }
    }
    return true
}

isPangram(str) // True
isPangram("Test string") // False

Swift 2.0:

func isPangram(str: String) -> Bool {
  let (char, alph) = (Set(str.characters), "abcdefghijklmnopqrstuvwxyz".characters)
  return !alph.contains {!char.contains($0)}
}

Tcl

proc pangram? {sentence} {
    set letters [regexp -all -inline {[a-z]} [string tolower $sentence]]
    expr {
        [llength [lsort -unique $letters]] == 26
    }
}
puts [pangram? "This is a sentence"];  # ==> false
puts [pangram? "The quick brown fox jumps over the lazy dog."]; # ==> true

TI-83 BASIC

:Prompt Str1
:For(L,1,26
:If not(inString(Str1,sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ",L,1))
:L=28
:End
:If L<28
:Disp "IS A PANGRAM"

(not tested yet)

TUSCRIPT

$$ MODE TUSCRIPT,{}
alfabet="abcdefghijklmnopqrstuvwxyz"
sentences = *
DATA The quick brown fox jumps over the lazy dog
DATA the quick brown fox falls over the lazy dog
LOOP s=sentences
 getchars      =STRINGS    (s," {&a} ")
 sortchars     =ALPHA_SORT (getchars)
 reducechars   =REDUCE     (sortchars)
 chars_in_s    =EXCHANGE   (reducechars," '  ")
 IF (chars_in_s==alfabet) PRINT "   pangram: ",s
 IF (chars_in_s!=alfabet) PRINT "no pangram: ",s
ENDLOOP
Output:
   pangram: The quick brown fox jumps over the lazy dog
no pangram: the quick brown fox falls over the lazy dog

TXR

@/.*[Aa].*&.*[Bb].*&.*[Cc].*&.*[Dd].*& \
  .*[Ee].*&.*[Ff].*&.*[Gg].*&.*[Hh].*& \
  .*[Ii].*&.*[Jj].*&.*[Kk].*&.*[Ll].*& \
  .*[Mm].*&.*[Nn].*&.*[Oo].*&.*[Pp].*& \
  .*[Qq].*&.*[Rr].*&.*[Ss].*&.*[Tt].*& \
  .*[Uu].*&.*[Vv].*&.*[Ww].*&.*[Xx].*& \
  .*[Yy].*&.*[Zz].*/
Run:
$ echo "The quick brown fox jumped over the lazy dog." | txr is-pangram.txr -
$echo $? # failed termination
1
$ echo "The quick brown fox jumped over the lazy dogs." | txr is-pangram.txr -
$ echo $?   # successful termination
0

UNIX Shell

Works with: Bourne Again SHell
Works with: Korn Shell
Works with: Z Shell
function is_pangram {
  typeset alphabet=abcdefghijklmnopqrstuvwxyz
  typeset -l string=$*
  while [[ -n $string && -n $alphabet ]]; do
    typeset ch=${string%%${string#?}}
    string=${string#?}
    alphabet=${alphabet/$ch}
  done
  [[ -z $alphabet ]]
}

Ursala

#import std

is_pangram = ^jZ^(!@l,*+ @rlp -:~&) ~=`A-~ letters

example usage:

#cast %bL

test =

is_pangram* <
   'The quick brown fox jumps over the lazy dog',
   'this is not a pangram'>
Output:
<true,false>

VBA

The function pangram() in the VBScript section below will do just fine.

Here is an alternative version:

Function pangram2(s As String) As Boolean
    Const sKey As String = "abcdefghijklmnopqrstuvwxyz"
    Dim sLow As String
    Dim i As Integer

    sLow = LCase(s)
    For i = 1 To 26
      If InStr(sLow, Mid(sKey, i, 1)) = 0 Then
        pangram2 = False
        Exit Function
      End If
    Next
    pangram2 = True
End Function

Invocation e.g. (typed in the Immediate window):

print pangram2("the quick brown dog jumps over a lazy fox")
print pangram2("it is time to say goodbye!")

VBScript

Implementation

function pangram( s )
	dim i
	dim sKey
	dim sChar
	dim nOffset
	sKey = "abcdefghijklmnopqrstuvwxyz"
	for i = 1 to len( s )
		sChar = lcase(mid(s,i,1))
		if sChar <> " "  then
			if instr(sKey, sChar) then
				nOffset = asc( sChar ) - asc("a")  + 1
				if nOffset > 1 then
					sKey = left(sKey, nOffset - 1) & " " & mid( sKey, nOffset + 1)
				else
					sKey = " " & mid( sKey, nOffset + 1)
				end if
			end if
		end if
	next
	pangram = ( ltrim(sKey) = vbnullstring )
end function

function eef( bCond, exp1, exp2 )
	if bCond then
		eef = exp1
	else
		eef = exp2
	end if
end function

Invocation

wscript.echo eef(pangram("a quick brown fox jumps over the lazy dog"), "is a pangram", "is not a pangram")
wscript.echo eef(pangram(""), "is a pangram", "is not a pangram")"

VTL-2

10 I=1
20 :I)=0
30 I=I+1
40 #=26>I*20
50 ?="Enter sentence: ";
60 C=$
70 #=C=13*120
80 C=C<97*32+C-96
90 #=C>27*60
100 :C)=1
110 #=60
120 ?=""
130 I=1
140 N=0
150 N=N+:I)
160 I=I+1
170 #=26>I*150
180 #=N=26*200
190 ?="not ";
200 ?="a pangram"
Output:
#=1
Enter sentence: The quick brown fox jumps over the lazy dog.
a pangram

OK
#=1
Enter sentence: This is not a pangram.
not a pangram

OK

Wren

Library: Wren-str
import "./str" for Str

var isPangram = Fn.new { |s|
    s = Str.lower(s)
    var used = List.filled(26, false)
    for (cp in s.codePoints) {
        if (cp >= 97 && cp <= 122) used[cp-97] = true
    }
    for (u in used) if (!u) return false
    return true
}

var candidates = [
    "The quick brown fox jumps over the lazy dog.",
    "New job: fix Mr. Gluck's hazy TV, PDQ!",
    "Peter Piper picked a peck of pickled peppers.",
    "Sphinx of black quartz, judge my vow.",
    "Foxy diva Jennifer Lopez wasn’t baking my quiche.",
    "Grumpy wizards make a toxic stew for the jovial queen."
]

System.print("Are the following pangrams?")
for (candidate in candidates) {
    System.print("  %(candidate) -> %(isPangram.call(candidate))")
}
Output:
Are the following pangrams?
  The quick brown fox jumps over the lazy dog. -> true
  New job: fix Mr. Gluck's hazy TV, PDQ! -> true
  Peter Piper picked a peck of pickled peppers. -> false
  Sphinx of black quartz, judge my vow. -> true
  Foxy diva Jennifer Lopez wasn’t baking my quiche. -> true
  Grumpy wizards make a toxic stew for the jovial queen. -> false

XPL0

include c:\cxpl\codes;          \intrinsic 'code' declarations
string 0;                       \use zero-terminated strings

func StrLen(Str);               \Return number of characters in an ASCIIZ string
char Str;
int  I;
for I:= 0 to -1>>1-1 do
        if Str(I) = 0 then return I;

func Pangram(S);
char S;
int  A, I, C;
[A:= 0;
for I:= 0 to StrLen(S)-1 do
        [C:= S(I);
        if C>=^A & C<=^Z then C:= C or $20;
        if C>=^a & C<=^z then [C:= C - ^a;  A:= A or 1<<C];
        ];
return A = $3FFFFFF;
]; \Pangram

int Sentence, I;
[Sentence:=
    ["The quick brown fox jumps over the lazy dog.",
     "Pack my box with five dozen liquor jugs.",
     "Now is the time for all good men to come to the aid of their country."];
for I:= 0 to 3-1 do
    [Text(0, if Pangram(Sentence(I)) then "yes" else "no");
    CrLf(0);
    ];
]
Output:
yes
yes
no

zkl

var letters=["a".."z"].pump(String); //-->"abcdefghijklmnopqrstuvwxyz"
fcn isPangram(text){(not (letters-text.toLower()))}
Output:
isPangram("The quick brown fox jumps over the lazy dog.")
True
isPangram("Pack my box with five dozen liquor jugs.")
True
isPangram("Now is the time for all good men to come to the aid of their country.")
False