Richard MacLemale wrote:
> Can anyone help with this one?
> If you have a field that says the following:
> The man said, "I cannot live on bread alone."
> ...and you ask MetaCard for word 4 of the field, you get the whole
> entire text string between the quotes ("I cannot live on bread
> alone."). Obviously this is not a "word", it's a phrase. Is there
> a way to get MetaCard to stop insisting that several words between
> quotation marks is one word? I do not want to modify the field's
> text to do this, nor do I wish to put the field into a variable and
> then delete the quotes from the variable... I just want MetaCard to
> recognize "I cannot live on bread alone." as 6 words, not one!
> Anyone? Anyone?
This is a (mis-)feature required for Hypercard compatability. Frankly
I'm not sure why the HC designers thought it was neccessary in the first
place.
I have two possible solutions. Firstly, you might like to try setting
the item delimiter to space and asking for items instead of words. I
haven't actually tested this myself in Metacard, but I've played with it
in HC and it works. But be warned that end of lines also delimit words,
but they won't if you use space-delimited items.
Secondly, if your handler can be adapted to this format, you could try
something like this:
on ProcessRealWords theText
for j = 1 to the number of words of theText
put word j of theText into theWord
if theWord contains space then
-- a quoted "word" or phrase
ProcessRealWords theWord -- call myself recursively
else -- a real word delimited by whitespace
DoStuff theWord
end if
end repeat
end ProcessRealWords
The nice thing is that quoted words cannot contain other quoted words,
so the handler will only call itself at most once per iteration.
==========================================
M.B. Sales Pty Ltd Ph: +61 3 9460-5244
A.C.N. 005-964-796 Fax: +61 3 9462-1161