Contact Us

Let us know to help you out quickly!

 Bharat Patel     Feb,08 2017

Remove null element and dangle delimiter from a list

Hello Friends,

In out day to day programming we use list. Sometimes we are getting list with some null element and dangle delimiter so we are applying code for removing null element. Today I have done simple and easy solution for that. I hope it will be helpful for you.

<cfset List1 = 'bharat,akash,,pritesh,,nirav,6,,7,'><b>List1</b> : <cfoutput>#List1#</cfoutput><br /><cfset List2 = ArrayToList(ListToArray(List1,','))><b>List2</b> : <cfoutput>#List2#</cfoutput>

Output as per above code is
List1 : bharat,akash,,pritesh,,nirav,6,,7,List2 : bharat,akash,pritesh,nirav,6,7