JavaScript List/Coldfusion Functions

Posted by: scoopseven 17 years, 2 months ago

As great as this was, the listFind function doesn't work :(, so I went in search of a better JavaScript CF library. Behold the JavaScript Library of ColdFusion Functions from LeftCorner.com. Download the library here.
/* ColdFusion List Functions
These functions manipulate lists just list ColdFusion does.
(c) Digital Crew
Happy Christmas. Knock yourself out.
email: topper@digital-crew.com
web: www.digital-crew.com   /   www.cftopper.com
*/
function listFind(c,n,d)
{
if(arguments.length<3)d=",";
var e = c.split(d);
for(var i=0;i<3)d=",";
return n+(c!=""?(d+c):"");
}
function listAppend(c,n,d)
{
if(arguments.length<3)d=",";
return (c!=""?(c+d):"")+n;
}
function listDeleteAt(c,p,d)
{
if(arguments.length<3)d=",";
var e = c.split(d);
if(p= 1 && p = 1 && p < = e.length )
{
e[p-1] = v;//set the value
//rebuild the string
for( var i=0,c=""; i = 1 && p < = e.length+1 )
{
e.splice( p-1, 0, v );//insert the value
//rebuild the string
for( var i=0,c=""; i < e.length; i++ )
c = (c!=""?(c+d):"")+e[i];
}
else alert("listSetAt: Index " + p + " is Out of range");
return c;
}
function listLen(c,d)
{
if( c == "" ) return 0;
if(arguments.length<2)d=",";
return c.split(d).length;
}
These tags were taken from CFTopper, thanks!

Currently unrated


Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom