* Added CFileHelper::getExtension

This commit is contained in:
qiang.xue
2010-03-31 19:35:21 +00:00
parent d822143bc9
commit 1aa9fe761e
2 changed files with 16 additions and 0 deletions

View File

@@ -18,6 +18,21 @@
*/
class CFileHelper
{
/**
* Returns the extension name of a file path.
* For example, the path "path/to/something.php" would return "php".
* @param string the file path
* @return string the extension name without the dot character.
* @since 1.1.2
*/
public static function getExtension($path)
{
if(($pos=strrpos($path,'.'))!==false)
return substr($path,$pos+1);
else
return '';
}
/**
* Copies a directory recursively as another.
* If the destination directory does not exist, it will be created.