Pangram checker: Difference between revisions

Content added Content deleted
(Undo revision 359844 by Steve Drain (talk) The previous edit had completely destroyed the task (probably by accident) except for an (edited) BBC Basic entry.)
(→‎{{header|BBC BASIC}}: Restored (edited) BBC Basic entry.)
Line 761: Line 761:
<pre>"The quick brown fox jumped over the lazy dog" is not a pangram
<pre>"The quick brown fox jumped over the lazy dog" is not a pangram
"The five boxing wizards jump quickly" is a pangram</pre>
"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}}==