CFLib.org – Common Function Library Project

ripExt(name)

Last updated July 18, 2006

Version: 1 | Requires: ColdFusion 5 | Library: FileSysLib

 
Rated 2 time(s). Average Rating: 5.0

Description:
This function (which is just a regular expression) strips off the extension from a filename. Dots within the filename are preserved.

Return Values:
Returns a string.

Example:

view plain print about
<cfset filename="this.is.your.file.jpeg">
<cfoutput>#ripExt(filename)#</cfoutput>

Parameters:

Name Description Required
name Filename. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * Function returns filename without extension.
 * 
 * @param name      Filename. (Required)
 * @return Returns a string. 
 * @author Richard (acdhirr@trilobiet.nl) 
 * @version 1, July 18, 2006 
 */

function ripExt(name) {
    return reReplace(arguments.name,"\.[^.]*$","");
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Robby Lansaw Robby Lansaw added
getComponentProp...
3 day(s) ago

Dave Anderson Dave Anderson added
iniToStruct
25 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
25 day(s) ago

Richard Richard added
dice
27 day(s) ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson