How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
This seems so simple, yet I couldn't figure out the answer even after going through the list and strings functions in the docs for CF 8. I want to return the characters in the name of a photo preceding the period. i.e.. If the photo is named dog.jpg, I want to strip out .jpg from the filename so

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
Thanks everyone, for the help... Here's the final solution, if anyone's interested: cffile action=upload filefield=photo_01_upload destination=#uppo# accept=image/jpg, image/pjpg, image/jpeg, image/pjpeg, image/png nameconflict=makeunique cfset form.photo_01=#file.serverfile#

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
Thanks, Todd... Can you explain the '^\w' part? Rick -Original Message- From: Todd [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 12:08 PM To: CF-Talk Subject: Re: How do I get the characters after the last period in a string? Regex example would be: cfset blah

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Jonathon Stierman
ListLast(dog.jpg,.) Jonathon -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 10:42 AM To: CF-Talk Subject: How do I get the characters after the last period in a string? This seems so simple, yet I couldn't figure out the answer

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Jerry Johnson
Use the list functions, with the period as the delimiter could there be more than one period? If so, you need to decide between two options (if not, then either will work) If you only want to remove the very last extension after the last period, cfset name=listDeleteAt(file,listLast(file,.),.)

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Todd
Regex example would be: cfset blah = asdflasdfasdfasdf.jpg cfdump var=#rematchNoCase('^\w*',blah)# On Nov 7, 2007 11:57 AM, Todd [EMAIL PROTECTED] wrote: Plenty of things to do here. 1.) Use regular expression. 2.) Treat the string as a list using the . as a delimiter (e.g.: cfset name =

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Todd
Plenty of things to do here. 1.) Use regular expression. 2.) Treat the string as a list using the . as a delimiter (e.g.: cfset name = listFirst(varname,'.') ) On Nov 7, 2007 11:41 AM, Rick Faircloth [EMAIL PROTECTED] wrote: This seems so simple, yet I couldn't figure out the answer even after

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Barney Boisvert
listLast(myString, .) cheers, barneyb On 11/7/07, Rick Faircloth [EMAIL PROTECTED] wrote: This seems so simple, yet I couldn't figure out the answer even after going through the list and strings functions in the docs for CF 8. I want to return the characters in the name of a photo preceding

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
Jerry... You hit upon something I thought about after I posted my solution. Yes, there definitely could be more than one period, since these are user-uploaded images. I'll modify my code to use: #listdeleteat(file,listlast(file.'.'),'.') Now, I'm assuming that the code above will work if

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Eric Cobb
ListFirst('dog.jpg','.') Rick Faircloth wrote: This seems so simple, yet I couldn't figure out the answer even after going through the list and strings functions in the docs for CF 8. I want to return the characters in the name of a photo preceding the period. i.e.. If the photo is

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Todd
Because CFImage isn't supposed to be used as a file system manipulation? Even functions like fileMove() doesn't even have one. Only one that I'm aware that has a nameconflict attribute is CFFile action=upload. There's a reason why we have functions like fileExists(). On Nov 7, 2007 1:14 PM,

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
You know... a better solution than what I've got, which is to only deal with as many as two periods in a filename, is needed. The current solution leaves some gaps if a user decides to user several periods as delimiters. And stripping out the periods, except for the one before the extension might

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Jerry Johnson
this will work for 1 or more, but will NOT work for none! (it will return an empty string) you should do a listLen(file,.) gt 0 test to make sure before you start. On Nov 7, 2007 1:21 PM, Rick Faircloth [EMAIL PROTECTED] wrote: Jerry... I'll modify my code to use:

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Todd
^ = start of string \w = Word * probably isn't needed. This regex doesn't account for multiple . characters, but that's not to say that you can't make it. \w will probably need changed to something else. I'm a hack at this, not an expert. :) Trying to get there. Regex cheat sheet:

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Charlie Griefer
On Nov 7, 2007 10:14 AM, Rick Faircloth [EMAIL PROTECTED] wrote: Thanks everyone, for the help... Here's the final solution, if anyone's interested: cffile action=upload filefield=photo_01_upload destination=#uppo# accept=image/jpg, image/pjpg, image/jpeg, image/pjpeg, image/png

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Web Specialist
cfset ext = GetToken(file_name,2,'.') Cheers 2007/11/7, Todd [EMAIL PROTECTED]: Plenty of things to do here. 1.) Use regular expression. 2.) Treat the string as a list using the . as a delimiter (e.g.: cfset name = listFirst(varname,'.') ) On Nov 7, 2007 11:41 AM, Rick Faircloth [EMAIL

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Bobby Hartsfield
Listlast(filename, '.') to get the extenstion And... ListDeleteAt(filename, listlen(filename, '.'), '.') to get everything except the extension (including the dot) It doesn't matter with either method whether there is 1 dot or 40. They will work as long as there is at least 1 dot present.

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Todd
cfset blah = asdflas.dfas.dfasdf.jpg cfdump var=#rematch('[^\s]+(?=\.(jpg|gif|png))\.',blah)# On Nov 7, 2007 1:58 PM, Rick Faircloth [EMAIL PROTECTED] wrote: You know... a better solution than what I've got, which is to only deal with as many as two periods in a filename, is needed. The

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Todd
Scratch the last, use this instead: cfset blah = as.d.f.l.as...d.f.a.s.dfasdf.jpg cfdump var=#rematch('[^\s]+(?=\.(jpg|gif|png)$)',blah)# On Nov 7, 2007 3:31 PM, Todd [EMAIL PROTECTED] wrote: cfset blah = asdflas.dfas.dfasdf.jpg cfdump var=#rematch('[^\s]+(?=\.(jpg|gif|png))\.',blah)# On

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
You're right... I should be using cffile for renaming... -Original Message- From: Todd [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 1:58 PM To: CF-Talk Subject: Re: How do I get the characters after the last period in a string? Because CFImage isn't supposed to be

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
Thanks, Todd! Rick -Original Message- From: Todd [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 3:32 PM To: CF-Talk Subject: Re: How do I get the characters after the last period in a string? cfset blah = asdflas.dfas.dfasdf.jpg cfdump

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
Thanks for the info, Charlie! Still working with those CF 4.5 ways. :o) Thanks for bringing this luddite up-to-speed! Rick -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 1:52 PM To: CF-Talk Subject: Re: How do I get the

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Charlie Griefer
am i missing something here? if you're trying to get the file name (sans extension) and extension (sas filename) -of an uploaded file-... why not the cffile variables that i mentioned earlier (or has my prior message not made it yet?) On Nov 7, 2007 11:53 AM, Bobby Hartsfield [EMAIL PROTECTED]

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Claude Schneegans
want to return the characters in the name of a photo preceding the period. ListFirst() man, listFirst! ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Claude Schneegans
Listlast(filename, '.') to get the extenstion or to get the file name if no extension... -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks.

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Bobby Hartsfield
Oh absolutely... cffile... I didn't see anything about getting it while uploading though so I assumed that the files already existed. ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent:

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Todd
I offered him 2 choices. ListFirst() and Regex. I gave examples of each. What more am I supposed to do? On Nov 7, 2007 5:39 PM, Claude Schneegans [EMAIL PROTECTED] wrote: Regex example would be: Hmmm, why make it simple when regExp could make it look more complicated? ;-)

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Dale Fraser
Or cfset sourceString = The.Quick.Brown.Fox / cfset result = listDeleteAt(sourceString, listLen(sourceString, .), .) / cfdump var=#result# / Regards Dale Fraser http://learncf.com -Original Message- From: Todd [mailto:[EMAIL PROTECTED] Sent: Thursday, 8 November 2007 7:39 AM To:

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
I saw your mention of those variables, Charlie, and I'm definitely going that way... they seem made just for my purposes. Rick -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 5:04 PM To: CF-Talk Subject: Re: How do I get the

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Adam Haskell
+1 On Nov 7, 2007 5:04 PM, Charlie Griefer [EMAIL PROTECTED] wrote: am i missing something here? if you're trying to get the file name (sans extension) and extension (sas filename) -of an uploaded file-... why not the cffile variables that i mentioned earlier (or has my prior message not

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Claude Schneegans
Todd... what would be the regex for deleting just the last period in a filename plux the extension? If you want to be that fussy, you should also take in account files with no extension at all. Personally, I rename the file using a UUID with no extension, then analyse the file to know exactly

Re: How do I get the characters after the last period in a string?

2007-11-07 Thread Claude Schneegans
Regex example would be: Hmmm, why make it simple when regExp could make it look more complicated? ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED])

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Dale Fraser
cfset result = listLast(sourceString, .) / Regards Dale Fraser http://learncf.com -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Thursday, 8 November 2007 7:46 AM To: CF-Talk Subject: RE: How do I get the characters after the last period in a string? You're

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Rick Faircloth
Thanks, Bobby... Rick -Original Message- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 2:53 PM To: CF-Talk Subject: RE: How do I get the characters after the last period in a string? Listlast(filename, '.') to get the extenstion And...

RE: How do I get the characters after the last period in a string?

2007-11-07 Thread Dale Fraser
cfset result = listDeleteAt(listLen(sourceString, .)) / Regards Dale Fraser http://learncf.com -Original Message- From: Todd [mailto:[EMAIL PROTECTED] Sent: Thursday, 8 November 2007 7:32 AM To: CF-Talk Subject: Re: How do I get the characters after the last period in a string? cfset