mrwalt 34 Posted June 4, 2016 Report Share Posted June 4, 2016 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. Quote Link to post Share on other sites
pash 504 Posted June 4, 2016 Report Share Posted June 4, 2016 not sure Because the sample data is incomplete add list to list(%Data,$list from text("green blue red yellow",$new line),"Delete","Global") 1 Quote Link to post Share on other sites
HelloInsomnia 1103 Posted June 4, 2016 Report Share Posted June 4, 2016 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) } } } 1 Quote Link to post Share on other sites
mrwalt 34 Posted June 5, 2016 Author Report Share Posted June 5, 2016 Thank you both for the suggestions and help as I will try this out. Quote Link to post Share on other sites
v_ladimir 2 Posted June 5, 2016 Report Share Posted June 5, 2016 (edited) 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 June 5, 2016 by v_ladimir Quote Link to post Share on other sites
denrich 4 Posted July 7, 2016 Report Share Posted July 7, 2016 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. Quote Link to post Share on other sites
denrich 4 Posted July 8, 2016 Report Share Posted July 8, 2016 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.