Hi

If you have some comments :)

Stef and Thibaut




testIsEnglishPangram

self assert: 'the quick brown fox jumps over the lazy dog' isEnglishPangram.
    self assert: 'the five boxing wizards jump quickly' isEnglishPangram.
    self deny: 'the quick brown fox jumps over the  dog' isEnglishPangram.

testIsPangramIn

self assert: ('The quick brown fox jumps over the lazy dog' isPangramIn: 'abcdefghijklmnopqrstuvwxyz').
    self assert: ('ma papa mama' isPangramIn: 'apm').

[[[
'portez ce vieux whisky au juge blond qui fume' isEnglishPangram
>>> true

'portons dix bons whiskys à l''avocat goujat qui fume au zoo.' isEnglishPangram
>>> true
]]]


isEnglishPangram
"Returns true is the receiver is a pangram i.e., that it uses all the characters of a given alphabet."
    "'The quick brown fox jumps over the lazy dog' isEnglishPangram
    >>> true"
    "'The quick brown fox jumps over the dog' isEnglishPangram
    >>> false"

    ^ self isPangramIn: 'abcdefghijklmnopqrstuvwxyz'.

isPangramIn: alphabet
"Returns true is the receiver is a pangram i.e., that it uses all the characters of a given alphabet." "'The quick brown fox jumps over the lazy dog' isPangramIn: 'abcdefghijklmnopqrstuvwxyz'
    >>> true"
    "'tata' isPangramIn: 'at'
    >>> true"

    alphabet do: [ :aChar |
        (self includes: aChar)
            ifFalse: [ ^ false ]
        ].
    ^ true


Reply via email to