<cfset myString = file.jpg>
<cfset myString = left(myString,len(myString)-4)> or something like that
should do what you're asking. You might need to adjust the 4 to be a 3 or 5
to account for a one-off error (I'm not near a CF machine at the moment and
can't test it).
A smarter way would be to parse for the last period and return everything
before that. Return everything if there is no period.
----- Original Message -----
From: "Chad Gray" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, February 07, 2001 11:55 AM
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