APL (88 9)
Update: the old one does not work for strings of different lengths.
{∧/∊⌿↑⍺⍵}
↑⍺⍵
: make a matrix with⍺
on the first line and⍵
on the second line, filling blanks with spaces.∊⌿
: For each column, see if the upper row contains the lower row (as in the old version).∧/
: Take the logicaland
of all the values.
Old one:
{∧/⍺∊¨⍵}
⍺∊¨⍵
: for each combination of elements in⍺
and⍵
, see if the element from⍺
contains the element from⍵
. Since in a string these will all be single characters, and a string contains itself, this is basically comparing each pair of characters.∧/
: take the logical and of all the values (if all the characters match, the strings are equal)