Jump to content
UBot Underground

How to remove blank lines from list?


Recommended Posts

Two ways come to mind. Test the variable before adding to the list. If the items being added are truly unique then you could set the option to remove duplicates and that would remove all blank lines. But I still would test before adding to the list.

Link to post
Share on other sites

I ran into this problem, the tricky aspect of it is that when you delete a row all the other rows shift up.

 

The way I did it was like this (it's quite robust way of doing it so i can use it for other situations)

 

#listposition = ($list total - 1);
Loop $list total
{

  If ($list item == $nothing)
  {
      #remove rows += (list position + ",")
  }

#listposition--
}

 

This gets me a variable "#remove rows" with all the rows that need to be deleted. I then create a list from that variable with "add to list" and use the "," i added as the delimiter. I then loop over each list item and delete the row.

 

The code above adds the highest list reference first so when you loop to "remove row" deleting the row doesnt effect the other row numbers.

Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...