Search the web
Sign In
New User? Sign Up
azcfug · Mailing list for the Phoenix ColdFusion User Group at azcfug.org. It serves primarily as an idea exchange for cf devlopers.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.

Messages

  Messages Help
Advanced
quick list question   Message List  
Reply Message #10456 of 10503 |
Re: [azcfug] quick list question

Well now you're just showing off :D

(but that's very cool) :)

On Wed, Nov 11, 2009 at 2:07 PM, Nathan Strutz <strutz@...> wrote:
 

Or here's one that works, and you can change the delimiter in an optional 3rd argument.

function listItemPrepend(list,str) {
    var delim = ",";
    if(arrayLen(arguments) EQ 3) { delim=arguments[3]; }
    return reReplace(arguments.list, "(\w+)(#delim#)?", "#arguments.str#\1\2", "all");


}

nathan strutz
[Blog and Family @ http://www.dopefly.com/]
[AZCFUG Manager @ http://www.azcfug.org/]
[Twitter @nathanstrutz]


On Wed, Nov 11, 2009 at 3:03 PM, Nathan Strutz <strutz@...> wrote:
Why not something simpler, like this

function listItemPrepend(list,str) {
    return reReplace(arguments.list, "(\w)+", "#arguments.str#\1", "all");

}


nathan strutz
[Blog and Family @ http://www.dopefly.com/]
[AZCFUG Manager @ http://www.azcfug.org/]
[Twitter @nathanstrutz]


On Wed, Nov 11, 2009 at 1:31 PM, Charlie Griefer <charlie.griefer@...> wrote:
 

All I can think of is a regular expression to prepend a '1' to any digit not preceded by another digit.  But, it doesn't work.

<cfset mylist = "(1,2,3,4,5)" />
<cfoutput>#rereplaceNoCase(myList, '([^\d])(\d)', '\1x\2', 'all')#</cfoutput>

In that rereplace(), the \1 is a reference to the non-digit character found in front of a digit character.  If you run the code above, you'll get:

(x1,x2,x3,x4,x5)

Which seems peachy, right?  Just replace the 'x' with a '1' in the expression above and you're golden.

But... then you end up with this:
<cfoutput>#rereplaceNoCase(myList, '([^\d])(\d)', '\11\2', 'all')#</cfoutput>

Which doesn't work because the regex engine is now looking for the 11th grouped reference instead of the first.

What I'm trying to say is... just use a loop :) 

But I posted this out of curiosity.  Any regex gurus know of a way to tell the regex engine to effectively break out of looking for a grouped reference?  A way to say "\1 -and- 1 -and- \2" ?



On Wed, Nov 11, 2009 at 12:11 PM, Cheryl Novalis-Marine <cheryl@...> wrote:
 

Anyone know if there is a cf function to update all the values in a list the same? I know I can easily do this my looping over the list, but just wondering if there is a function too that can do this.  

 

For example here is my list (1,2,3,4,5) and I want to insert a 1 in front of each value so that this list is now (11,12,13,14,15).

 

Thanks,
Cheryl




--
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.





--
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.


Wed Nov 11, 2009 10:08 pm

cgriefer
Online Now Online Now
Send Email Send Email

Message #10456 of 10503 |
Expand Messages Author Sort by Date

Anyone know if there is a cf function to update all the values in a list the same? I know I can easily do this my looping over the list, but just wondering if...
Cheryl Novalis-Marine
zooeycat1
Offline Send Email
Nov 11, 2009
8:13 pm

All I can think of is a regular expression to prepend a '1' to any digit not preceded by another digit. But, it doesn't work. <cfset mylist = "(1,2,3,4,5)" />...
Charlie Griefer
cgriefer
Online Now Send Email
Nov 11, 2009
8:32 pm

Why not something simpler, like this function listItemPrepend(list,str) { return reReplace(arguments.list, "(\w)+", "#arguments.str#\1", "all"); } nathan...
Nathan Strutz
nathan_strutz
Offline Send Email
Nov 11, 2009
10:05 pm

Or here's one that works, and you can change the delimiter in an optional 3rd argument. function listItemPrepend(list,str) { var delim = ","; ...
Nathan Strutz
nathan_strutz
Offline Send Email
Nov 11, 2009
10:07 pm

Well now you're just showing off :D (but that's very cool) :) ... -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But...
Charlie Griefer
cgriefer
Online Now Send Email
Nov 11, 2009
10:08 pm

Hi, I am trying to write a test utility that gets a pdf file from a site and then stores it in a folder with the name of the file being #Now()# or in other...
coldfusionapps@...
Send Email
Dec 7, 2009
2:13 pm

Can you send us the code you are currently using in the cffile? ... -- Alan Rother Adobe Certified Advanced ColdFusion MX 7 Developer Manager, Phoenix Cold...
Alan Rother
alanrother
Offline Send Email
Dec 7, 2009
3:25 pm

the URL is changed below to my.url.com for security reasons. <cfhttp url="https://my.url.com/images/PDFQk1DcUFjOXg5d0tQenc.pdf" resolveurl="yes"/> <cffile...
coldfusionapps@...
Send Email
Dec 7, 2009
5:25 pm

AHHH... I thought so <cfhttp url="https://my.url.com/images/PDFQk1DcUFjOXg5d0tQenc.pdf" resolveurl="yes" getasbinary="yes"/> I tested it on my server using...
Alan Rother
alanrother
Offline Send Email
Dec 7, 2009
5:35 pm

http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00001609.htm To get a binary file...
Jeffrey Roberson
hippiex
Offline Send Email
Dec 7, 2009
5:35 pm

I think that is a browser issue. I had a similar problem when creating dynamic PDFs. You need to either redirect to it or display a link. From:...
Cheryl Novalis-Marine
zooeycat1
Offline Send Email
Dec 9, 2009
12:01 pm

Because my regex-fu is weak :) ... -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my ...
Charlie Griefer
cgriefer
Online Now Send Email
Nov 11, 2009
10:08 pm

How about this? http://cflib.org/udf/ListElementPrepend nathan strutz [Blog and Family @ http://www.dopefly.com/] [AZCFUG Manager @ http://www.azcfug.org/] ...
Nathan Strutz
nathan_strutz
Offline Send Email
Nov 11, 2009
8:32 pm

But that's (technically) looping :) ... -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my...
Charlie Griefer
cgriefer
Online Now Send Email
Nov 11, 2009
8:33 pm

Thanks guys. Was just curious. I wrote it with cfloop. I like to ask these types of questions because since I have been using CF for like 4 versions now...
Cheryl Novalis-Marine
zooeycat1
Offline Send Email
Nov 11, 2009
9:54 pm

Thanks Nate. That's still looping:) From: azcfug@yahoogroups.com [mailto:azcfug@yahoogroups.com] On Behalf Of Nathan Strutz Sent: Wednesday, November 11, 2009...
Cheryl Novalis-Marine
zooeycat1
Offline Send Email
Nov 11, 2009
9:53 pm

Hey, it's still looping, but it's already written, no brainwork necessary. nathan strutz [Blog and Family @ http://www.dopefly.com/] [AZCFUG Manager @...
Nathan Strutz
nathan_strutz
Offline Send Email
Nov 11, 2009
9:54 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help