splits given fileName into name and extension.

@param fileName fileName
@return string array is of length 2, where 1st item is name and 2nd item is extension(null if no extension)
330045
public static String[] split(String fileName){
        int dot = fileName.lastIndexOf('.');
        if(dot==-1)
            return new String[]{ fileName, null };
        else
            return new String[] { fileName.substring(0, dot), fileName.substring(dot+1)};
    }
1065898
protected function createFileName($fileName)
    {
        return $this->parseFileName($fileName) . $this->suffix() . $this->config->fileExtension();
    }
1174401
public static function removeExtension($filename)
    {
        if (false === strrpos($filename, '.')) {
            return $filename;
        }

        return substr($filename, 0, strrpos($filename, '.'));
    }
713767
def split_extension(pathname):
        
        filepart = win32.PathRemoveExtension(pathname)
        extpart  = win32.PathFindExtension(pathname)
        return (filepart, extpart)
657801
def parseFilename(filename):
    

    # Parse out any extension specified in filename
    _indx = filename.find('[')
    if _indx > 0:
        # Read extension name provided
        _fname = filename[:_indx]
        _extn = filename[_indx + 1:-1]
    else:
        _fname = filename
        _extn = None

    return _fname, _extn
111994
protected function getFileName(string $fileName): ?string
    {
        if (!$fileName) {
            return null;
        }

        if (filter_var($fileName, FILTER_VALIDATE_URL)) {

            try {
                $headers = (get_headers($fileName));
            } catch (Throwable $exception) {
                report($exception);
                sleep(1);

                if ($this->headerCallAttempts < 5) {

                    $this->headerCallAttempts++;

                    return $this->getFileName($fileName);
                }

                throw $exception;
            }

            $this->headerCallAttempts = 0;

            foreach ($headers as $header) {
                if (strpos($header, 'filename')) {
                    $name = explode('filename="', $header);
                    $name = rtrim($name[1], '"');

                    $name = explode('.', $name);

                    if (sizeof($name) > 1) {
                        return str_slug(implode('.', $name));
                    }
                }
            }
        }

        $explodeFileURL = explode('/', $fileName);
        $fileName = end($explodeFileURL);

        $explodedByParams = explode('?', $fileName);
        $fileName = head($explodedByParams);

        $string = sanitizeString(pathinfo($fileName, PATHINFO_FILENAME));

        if (strpos($fileName, '.') !== false && substr($fileName, -3) != 'php') {
            return $string . '.' . pathinfo($fileName, PATHINFO_EXTENSION);
        } else {
            return $string;
        }
    }
170130
public static function splitClassName ( $className )
    {
        $chunk = explode('\\', $className);
        $className = array_pop($chunk);
        $namespace = implode('\\', $chunk);
        $result = array($namespace, $className);
        return $result;
    }
1114454
public function getUniqueFilename($filename)
    {
        $info = pathinfo($filename);
        $name = $info['filename'];
        $ext = isset($info['extension']) ? '.'.$info['extension'] : '';
        for ($i = 1; file_exists($info['dirname'].'/'.$name.$ext); ++$i) {
            $name = $info['filename'].'['.$i.']';
        }

        return $info['dirname'].'/'.$name.$ext;
    }
407983
def extension(filename):
    ''''''
    filename = os.path.basename(filename)
    extension = None

    while '.' in filename:
        filename, ext = os.path.splitext(filename)
        if ext.startswith('.'):
            ext = ext[1:]
        extension = ext if not extension else ext + '.' + extension

    return extension
71671
protected function checkFileName($fileName)
    {
        $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));

        $allow = $this->getWhitelistedExtensions();
        $block = $this->getBlacklistedExtensions();

        return  (   (false === $allow || in_array($extension, $allow))
                &&  (false === $block || ! in_array($extension, $block))
                );
    }
1196593
protected function removeExtensionFromFilename($filename, $extension)
    {
        $extension = '.'.$extension;
        $extension_length = mb_strlen($filename) - mb_strlen($extension);
        if (mb_strrpos($filename, $extension) === $extension_length) {
            $filename = mb_substr($filename, 0, $extension_length);
        }

        return $filename;
    }
400137
protected static function iterateFileName(string $fileName)
    {
        //First remove Extension
        $arrFileParts = explode(".", $fileName);
        $extension = array_pop($arrFileParts);
        $tempFileName = implode(".", $arrFileParts);
        $arrFileName = explode("_", $tempFileName);
        if (is_numeric($arrFileName[(count($arrFileName) - 1)])) {
            $iterator = (int) array_pop($arrFileName);
            $iterator++;
            $arrFileName[] = $iterator;
            $newFileName = implode("_", $arrFileName);
            return $newFileName . "." . $extension;
        }
        return $tempFileName."_1." . $extension;
    }
1169420
private function parseFilename($filename) {
    if (defined('DRUPAL_ROOT') && stripos($filename, DRUPAL_ROOT) === 0) {
      return substr($filename, strpos($filename, DRUPAL_ROOT) + strlen(DRUPAL_ROOT) + 1);
    }
    else {
      return $filename;
    }
  }
852839
public static String getSafeExtension(final String filename) {
        // extension does not include period (.)
        final String extension = FilenameUtils.getExtension(filename);
        return isSafeExtension(extension) ? "." + extension : StringUtils.EMPTY;
    }
603564
public static function getExtension($filename = '', $dot = false)
    {
        if (empty($filename)) {
            return '';
        }
        $exploded_file_name = explode('.', $filename);
        return (strpos($filename, '.') ? ($dot ? '.' : '').end($exploded_file_name) : null);
    }
1362305
protected static String trimFileExtension(String fileName) {
		if (fileName.lastIndexOf('.') == -1) {
			return fileName;
		}
		return fileName.substring(0, fileName.lastIndexOf('.'));
	}
616502
def splitname(path):
    """"""
    dirpath, filename = os.path.split(path)
    # we don't use os.path.splitext here because we want all extensions,
    #  not just the last, to be put in exts
    name, exts = filename.split(os.extsep, 1)
    return dirpath, name, exts