Jump to content
UBot Underground

What Is The Best To Remove Blank Spaces Within A List Or Table?


Recommended Posts

Quick question what would be the best way to remove a blank spaces from a list or table?

 

Example below:

 

(0) green

(1) 

(2) blue

(3) red

(4)

(5) yellow

 

 

Any ideas that you wish to share would be greatly appreciated.

Link to post
Share on other sites

not sure Because the sample data is incomplete

add list to list(%Data,$list from text("green

blue
red

yellow",$new line),"Delete","Global")

  • Like 1
Link to post
Share on other sites

Try this, note that there are spaces and the items are not actually blank that is why there is a $trim in there. If you try to add it like Pash did, it won't add the blank items which is what I think he was trying to point out.

clear list(%data)
add list to list(%data,$list from text("green, ,blue,red,  ,yellow,   ,purple",","),"Delete","Global")
set(#list_item,0,"Global")
loop($list total(%data)) {
    if($is blank($trim($list item(%data,#list_item)))) {
        then {
            remove from list(%data,#list_item)
        }
        else {
            increment(#list_item)
        }
    }
}
  • Like 1
Link to post
Share on other sites

Try this:

add list to list(%NewData,$find regular expression("green

blue
red

yellow","\\w+"),"Delete","Global")

With Helloinsomnia example:

add list to list(%NewData,$find regular expression("green, ,blue,red,  ,yellow,   ,purple","\\w+"),"Delete","Global")
Edited by v_ladimir
Link to post
Share on other sites
  • 1 month later...
I find this define command works well.
 
 

 

 

Try this:

add list to list(%NewData,$find regular expression("green

blue
red

yellow","\\w+"),"Delete","Global")

With Helloinsomnia example:

add list to list(%NewData,$find regular expression("green, ,blue,red,  ,yellow,   ,purple","\\w+"),"Delete","Global")

 

define Remove blanks from list {
    set(#listtotal,$list total(%PROXY_LIST),"Global")
    decrement(#listtotal)
    remove from list(%PROXY_LIST,#listtotal)
}
 
 
 
 
Den.
Link to post
Share on other sites

 

I find this define command works well.
 
 

 

 

define Remove blanks from list {
    set(#listtotal,$list total(%PROXY_LIST),"Global")
    decrement(#listtotal)
    remove from list(%PROXY_LIST,#listtotal)
}
 
 
 
 
Den.

 

Sorry guys this script to remove last line or last blank line from a list.

Link to post
Share on other sites

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...