07-19-2011 02:57 AM
hi,
maybe its simple and easy but I dont understand. I try delete empty strings from array but I fail.
For example:
[index]string
[0]tom
[1]adam
[2]eve
[3]
[4]
[5]
[6]peter
[7]jane
[8]
result
[0]tom
[1]adam
[2]eve
[3]peter
[4]jane
thanks
Norbert
Solved! Go to Solution.
07-19-2011 03:20 AM
I find solution 🙂
07-19-2011 03:25 AM
A couple of options attached.
The first is pretty simple and autoindexes an array in a for loop. Might not be too efficient for big arrays.
The 2nd uses the OpenG filter 1D array - search for OpenG if you haven't encountered it... its a toolkit of functions which can be used in your code subject to some fairly mild conditions.
Also, consider voting for Jim Kring's idea which would make this even easier.
07-19-2011 03:29 AM
thanks _lan_ for your help but I find solution
07-19-2011 03:29 AM - edited 07-19-2011 03:30 AM
@timing wrote:
I find solution 🙂
Your code will work...it is similar to the OpenG option. BUT...
There is no need for the local variables!
Look at using shift registers instead of carelessly dropping local variable everywhere... it'll save you trouble later on!
07-19-2011 03:38 AM
oh yes its works with shift registers...I dont understand too shift register and I try use local variables.
Hmm
_lan_ what is different for your code and my code? I thing shift register and local variable because you write trouble later on.
Thanks
07-19-2011 03:38 AM
@_Ian_ wrote:
@timing wrote:
I find solution 🙂
Your code will work...it is similar to the OpenG option. BUT...
There is no need for the local variables!
Look at using shift registers instead of carelessly dropping local variable everywhere... it'll save you trouble later on!
Even worse... there's no guarantee that the terminal is written before the local variable is read... that could lead to unexpected results. So the code doesn't necessarily work.
07-19-2011 03:50 AM
dan_u
hmmm and your solution or any idea to correct code for delete empty strings from array?
thanks
07-19-2011 03:51 AM
As Ian wrote... just replace your local variables with a shift register. Wire the array to the outside of the shift register and modify it in the loop.
07-19-2011 03:55 AM - edited 07-19-2011 03:57 AM