Text variable problem

Sarah Reichelt sarah.reichelt at gmail.com
Sun May 24 05:30:43 EDT 2009


> I have a very irritating problem occurring. In one part of my program a
> global variable, g_region, is set to the name of a US state or Canadian
> province. Later in the program there is a loop that compares the 17th
> element of the line to g_region. If g_region and element 17 of the line are
> the same, the program does something. Using the variable watcher, I can see
> that g_region is set to a states name, and I can see that the 17th element
> of the line is the same state as g_region. But the loop doesn't acknowledge
> that the two are equivalent. I have tried :
>
> "repeat for each line regLine in lData
>   if item 17 of regLine = g_reg then //and I've tried "is" in place of the
> equals sign, too.
>      put item 17 of regLine into regFiltered
>   end if
> end repeat"

I have had problems with this sort of thing if there are any extra
spaces in the data.
Try:
if item 17 of regLine contains g_reg then
....

Cheers,
Sarah



More information about the use-livecode mailing list