<cfset new = Left(Input,(Len(Input) - 4))>

What you need to do is get the total length of the string and then subtract 
4, this will tell you how many chars are left.


At 03:41 PM 2/7/2001 -0500, you wrote:
>Look at the List functions within ColdFusion - they are extremely useful.
>In your example, you could say
>
><cfset newfilename = ListFirst(File.ServerFile,".")>
>
>Note that you don't need the # signs inside the <CFSET> tag.
>
>Bob
>
>-----Original Message-----
>From: Chad Gray [mailto:[EMAIL PROTECTED]]
>Sent: February 7, 2001 1: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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to