Given a set of characters, this will tell you if the specified word can be created from that set.
print containsWord("abcdgero", "dog")
print containsWord("abcdger", "dog")
print containsWord("abcdgero", "dogg")
wait key
end
rem Returns true if the letters making up W$
rem are found in S$
function containsWord(s$, w$)
for i = 1 to len(w$)
j = containsLetter(s$, mid$(w$, i))
if j > 0
s$ = removeChar$(s$, j)
else
exitfunction 0
endif
next i
endfunction 1
rem Returns the index in S$ that matches character C$
function containsLetter(s$, c$)
for i = 1 to len(s$)
if mid$(s$, i) = c$ then exitfunction i
next i
endfunction 0
rem Returns string S$ with character at position I removed
function removeChar$(s$, i)
s$ = left$(s$, i-1) + right$(s$, (len(s$)-i))
endfunction s$
"You're all wrong. You're all idiots." ~Fluffy Rabbit