If you think of your string "file.jpg" as a list made up of two strings
"file" and "jpg" delimited by the period, you can do this:

<cfset filename = ListFirst(file.jpg, ".")>
<cfoutput>#filename#</cfoutput> ==> will give you "file"

HTH,

Chris Montgomery             [EMAIL PROTECTED]

Web Development & Consulting http://www.astutia.com
Allaire Consulting Partner
210-490-3249/888-745-7603    Fax 210-490-4692
AIM: astutiaweb; ICQ: 7381282; Firetalk: Ag78

> -----Original Message-----
> From: Chad Gray [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 07, 2001 12:56 PM
> To: CF-Talk
> Subject: trim a string variable
>
>
> Is there a way to trim a string like : file.jpg
> to  : file
> (aka knock off the last 4 characters)
>
> <cfset newfilename = #left(File.ServerFile,4)#>  Does not work
> because the
> name of the file in the database could be longer then 4 characters
>
> Is there a function that im missing to trim off the last 4
> characters of a
> variable?
>
> Thanks
> Chad


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to