Re: how to get the zero's out of a list
Re: how to get the zero's out of a list
- Subject: Re: how to get the zero's out of a list
- From: g3pb <email@hidden>
- Date: Fri, 09 Mar 2001 11:22:05 -0900
Using a variable name of 3aL2 was not dissimilar from the variable names
used by the original poster
-- hcir
mailto:email@hidden
Made with a Mac!
>
> set cell "B" of current record to A
>
>
>
> --> becomes {"0", "1", "0", "4"}
>
> but i want {"", "1", "", "4"}
>
>
>
>
>
> How, oh how do i do this ?
>
>
Three people responded with essentially the same solution:
>
>
set a to {"0", "1", "0", "4"}
>
repeat with i from 1 to count (a)
>
if item i of a is "0" then set item i of a to ""
>
end repeat
>
>
set l to {"0", "1", "0", "4"}
>
repeat with i from 1 to length of l
>
tell item i of l to if it = "0" then set item i of l to ""
>
end
>
l
>
>
set aL to {"0", "1", "0", "2"}
>
repeat with i from 1 to number of items in aL
>
if item i in aL is "0" then
>
set item i in aL to ""
>
end if
>
end repeat
>
>
I am disappointed that the answers to such a question, asked by what
>
appears to be a novice, while offering something that works,
>
nevertheless include the use of variable names like "a", "l", and
>
"aL".
>
[Using "i", "1", and "l" in the same script fragment (and even in the
>
same line) makes it hard to distinguish what from what. The same can
>
be said for "i" and "a".]
>
>
When posting examples, particularly for newbies, be mindful that the
>
person asking the question may not just be interested in a piece of
>
script that they can copy and paste, but may be trying to understand
>
how something works. Try to remember what it was like when you were
>
first learning. Taking a few extra seconds to employ variable names
>
that are descriptive, indicating what the variables contain, can go a
>
long way toward making your examples understandable.