Posts

Showing posts with the label array

Coldfusion - Using ListFind and Split to get empty elements in a list

I am working with a lot of data import modules in ColdFusion and there are a lot of issues to handle while doing the import process. The data uploaded will be of different format, different delimiters, empty or null values etc. etc. Here, I am describing a problem where the delimiter is tab and the first element is null. I had to check whether the first element is null. I tried using ListGetAt(stringVariable,1,Chr(9)). Now, what this returned was the first non-empty element and not possible to check whether the first element was null.

Array functions in JavaScript

Here are some of the functions useful for array operations Push() - Appends one or more elements to the end of an array var data = [ "A" ]; data.push( "B" ); data.push( "C" ); Result data = ["A","B","C"] Pop() - Pops out (removes) one element from the end of an array var data = ["A","B","C"]; data.pop(); Result data = ["A","B"]; Unshift() - Adds one or more elements to the beginning of an array var data = [ "A" ]; data.unshift( "B","X" ); data.unshift( "C" ); Result data = ["C","B","X","A"] Shift() - Removes one element from the beginning of an array var data = ["A","B","C"]; data.shift(); Result data = ["B","C"]; Splice() - Removes elements specified number of items from the starting index and also op...