getExtension(name)
Last updated May 9, 2003
Version: 2 | Requires: ColdFusion 5 | Library: FileSysLib
Description:
Submit a filename and function will return extension. If no period exists in the filename, an empty string is returned.
Return Values:
Returns a string.
Example:
<cfoutput>
getExtension(tmp) = #getExtension(tmp)#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| name | File name to use. | Yes |
Full UDF Source:
<cfscript>
/**
* Returns extension defined by all characters following last period.
* v2 by Ray Camden
*
* @param name File name to use. (Required)
* @return Returns a string.
* @author Alexander Sicular (as867@columbia.edu)
* @version 2, May 9, 2003
*/
function getExtension(name) {
if(find(".",name)) return listLast(name,".");
else return "";
}
</cfscript>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
11 day(s) ago
Will Belden added
longTime
17 day(s) ago
James Sleeman added
quickSort
27 day(s) ago
Ben Forta added
GetHostAddress
29 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)