try this - 

<cfset filename = "somefilename.txt" >

<cfset dotposition = find('.',filename,1)>

<cfset stripfilename = left(filename,(dotposition - 1) )>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
        <title>Untitled</title>
</head>

<body>

<cfoutput>
#filename#<br>
#dotposition#<br>
#stripfilename#<br>

</cfoutput>


</body>
</html>

good luck,

Alexander Sicular
Technical Director, Information Technology
The Neurological Institute of New York
Columbia University
212.305.1318
[EMAIL PROTECTED]


-----Original Message-----
From: Chad Gray [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 07, 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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to