You could use the built in listToArray
myarray = listToArray('homer,marge,bart');
Cheers,
Sam F
On 1/4/06, Ryan Guill [EMAIL PROTECTED] wrote:
How about one for an array?
This is pretty cool.
~|
Message:
I've been using cf since version 3, and I always remember it being there.
I've always used, helped me immensely.
It reminds me of ValueList(). I'm not sure how long that's been
available in CF (seems like it's new to CF6 or CF7), but I've
heard people say That was something I always had to
it = valuelist()
I've been using cf since version 3, and I always remember it being there.
I've always used, helped me immensely.
Visit http://training.figleaf.com/ for more information!
~|
Message:
It is very handy. It's one of those 'well duh!' functions that CF has,
that a lot of people don't know about. I've been using CF since v. 4,
and I just found out about it a few months ago. :) But I've never read
any CF books or had any training (aside from conferences), so that might
explain
I got curious and tried the same thing in tag syntax and it works too:
cffunction name=Struct returntype=struct
cfreturn arguments
/cffunction
Just when I though there was a use for cfscript after all... :-)
On 1/5/06, Brendan Baldwin [EMAIL PROTECTED] wrote:
Here's the actual function in
Here's the actual function in cfscript:
function Struct() { return arguments; }
I posted about its use here:
http://www.brendanbaldwin.com/post/structfunction/
Basically though, it lets you do this:
customer=Struct(id=1,name=Brendan,occupation=Web-Lackey);
Which does the equivalent of:
-Original Message-
From: Brendan Baldwin [mailto:[EMAIL PROTECTED]
function Struct() { return arguments; }
That's brilliant! :-D You need to get that in cflib!
--
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
How about one for an array?
This is pretty cool.
On 1/4/06, Damien McKenna [EMAIL PROTECTED] wrote:
-Original Message-
From: Brendan Baldwin [mailto:[EMAIL PROTECTED]
function Struct() { return arguments; }
That's brilliant! :-D You need to get that in cflib!
--
Damien
newStruct, I believe, is already in cflib to do the same thing.
newArray as well, I believe. Now if only these were built-ins, so we
could actually a struct and array literals in CFML, but oh well.
cheers,
barneyb
On 1/4/06, Damien McKenna [EMAIL PROTECTED] wrote:
-Original Message-
I think it should be a language feature.
Same thing happened with everybody writing a custom tag to do the same
thing they finally did with CFSAVECONTENT. Just feels too basic to
not be included in the core language somehow.
But it was fun to have the lightbulb go off in my head. I'd been
:[EMAIL PROTECTED]
Sent: Wednesday, January 04, 2006 2:38 PM
To: CF-Talk
Subject: Re: Smallest, coolest function I ever wrote: Struct()
I think it should be a language feature.
Same thing happened with everybody writing a custom tag to do the same
thing they finally did with CFSAVECONTENT
It reminds me of ValueList(). I'm not sure how long that's been
available in CF (seems like it's new to CF6 or CF7), but I've heard
people say That was something I always had to code every time, I didn't
know that function existed!
Not 100% surebut I think it's been around since 3.1 or 4
CFLib had one - but I have updated it with this version.
-ray
On 1/4/06, Damien McKenna [EMAIL PROTECTED] wrote:
-Original Message-
From: Brendan Baldwin [mailto:[EMAIL PROTECTED]
function Struct() { return arguments; }
That's brilliant! :-D You need to get that in cflib!
--
That's a nice function Brendan. Good job.
andy
Here's the actual function in cfscript:
function Struct() { return arguments; }
I posted about its use here:
http://www.brendanbaldwin.com/post/structfunction/
Basically though, it lets you do this:
You know, what I'd REALLY like is for CFScript to adopt the JavaScript
convention of allowing the creation of Structs like:
person = {id=1,name=Brendan,occupation=Thumb-Twiddler};
Of course, they could throw in an Array constructor too:
people = [Brendan,Ray,Andy];
I can dream... or switch to
PROTECTED]
Sent: January 4, 2006 6:12 PM
To: CF-Talk
Subject: Re: Smallest, coolest function I ever wrote: Struct()
You know, what I'd REALLY like is for CFScript to adopt the JavaScript
convention of allowing the creation of Structs like:
person = {id=1,name=Brendan,occupation=Thumb-Twiddler
It reminds me of ValueList(). I'm not sure how long that's been
available in CF (seems like it's new to CF6 or CF7), but I've
heard people say That was something I always had to code every
time, I didn't know that function existed!
I'm pretty sure it's been there since CF 2 if not earlier.
-Original Message-
From: Brendan Baldwin [mailto:[EMAIL PROTECTED]
Sent: January 4, 2006 6:12 PM
To: CF-Talk
Subject: Re: Smallest, coolest function I ever wrote: Struct()
You know, what I'd REALLY like is for CFScript to adopt the JavaScript
convention of allowing the creation of Structs like
18 matches
Mail list logo