12-17-2013 11:26 PM
I want to delete empty strings from my array, i have made the program for removing, it is working fine for all other array of strings, but for my input array it is not deleting empty strings.
Below i am attaching vi.
12-17-2013 11:27 PM
I forgot to attach the vi in the last post, here is the vi.
Thankyou
12-17-2013 11:32 PM
Your strings aren't empty.
Change the display style for the strings to either hex display or \codes display. You'll see that your "empty" strings actually contain a tab character. Actually all the array elements begin with a tab character (probably left over from some parsing of a tab delimited file?)
Go through your array and do a search and replace to eliminate all of the tab characters with nothing. Then put it through your loop.
12-18-2013 12:01 AM - edited 12-18-2013 12:06 AM
In other way you can use the "Trim white space" function and eliminate the tab constants.
Good luck
12-18-2013 01:07 AM - edited 12-18-2013 01:10 AM
Easiest would be to just look if the string size is 1 or less. It is not good coding practice to use "delete from array" in a loop, because the constant array resizing causes memory allocation issues. Here's how to do it in-place, then trim at the end.
This could be made even simpler with the implementation of this idea, so please vote for it :))
(Also note that your original code is incorrect, because the FOR loop spins way too many times. you should use a while loop instead and stop when nothing is found anymore).
12-18-2013 01:35 AM
12-18-2013 02:04 AM
@udka wrote:
-For me it looks like for loop with condition terminal will be good (can you please tell me) after looking at this link
There are dozens of diferent ways to do this, and the choice of loop is probably a minor issue. The rest of the algorithm is probably more important. 😄