Arraysearch()

David Thompson dthmpsn1 at uiuc.edu
Mon Apr 7 10:55:47 PDT 2008


>Arraysearch() returns a number, the number of the array item which 
>meets a certain text criteria, right?
>
>Here's the command to try this out:
>
>message array(slug,arraysearch(slug,Music*,1,¶),¶)
>
>where slug = lvariable containing a chunk of text, each line ending 
>with a ¶
>Music = the first word in the line I want to extract
>
>Following the example in the Reference, the word searched for (here, 
>Music) has no formatting (ie., "Music") beyond the wild card 
>characters "?" and "*".
>
>As soon as I append "*" to my search word (to find the number of the 
>array item which begins with that word), the procedure window 
>complains (Operand expected but not found) as if it wanted to do some 
>multiplication.
>
>Am I missing something?

You've explained it perfectly. That's exactly 
what it thinks you want it to do, and the other 
multiplication operand is missing. You need to 
write it

message array(slug,arraysearch(slug,Music+"*",1,¶),¶)

That will append the * to the contents of the Music variable.

Dave


More information about the Qna mailing list