Given a file name, get its file number (if any).

        @param filename: A C{str} file name.
        @return: An C{int} file number or C{None} if no file with that name
            has been added.
333068
def _getFileNumber(self, filename):
        
        cur = self._connection.cursor()
        cur.execute('SELECT id FROM files WHERE name = ?', (filename,))
        row = cur.fetchone()
        if row is None:
            return None
        else:
            return row[0]
1080260
private static int getIndexFromFilename(String fileName) {
        // remove the beginning of the file name
        String resStr = fileName.replace(
                latestMOTDSerializedFileName.substring(0, latestMOTDSerializedFileName.indexOf("{index}")), "");

        // remove the end of the file name
        resStr = resStr.replace(
                latestMOTDSerializedFileName.substring(latestMOTDSerializedFileName.indexOf("{index}") + 7), "");

        return Integer.parseInt(resStr);
    }
975917
public static int countLines(String filename) throws IOException {
        FileInputStream fis = new FileInputStream(filename);
        try {
            return countLines(new BufferedInputStream(fis));
        } finally {
            fis.close();
        }
    }
565986
public static boolean isArchiveFileName(String fileName) {
        String extension = getExtension(fileName);
        return ARCHIVE_EXTENSION_SET.contains(extension);
    }
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;
    }
586637
public function getNameFromFile($filename)
	{
		$i = strrpos($filename, self::getSlash());

		if ($i!== false)
		{

			return substr($filename, $i+1);
		}
		else
		{
			return $filename;
		}
	}
999827
def _getFilename(self, fileNumber):
        
        cur = self._connection.cursor()
        cur.execute('SELECT name FROM files WHERE id = ?', (fileNumber,))
        row = cur.fetchone()
        if row is None:
            return None
        else:
            return row[0]
685011
def name=(filename)
      @dirty = true
      # dot and double dot are special cases (no processing please).
      if filename != "." and filename != ".."
        if filename.size > 12 || (not filename.include?(".") && filename.size > 8)
          mkLongName(filename)
          @name = self.longName
        else
          @dir_ent['name'] = mkSfn(filename)
          @name = self.shortName
        end
      else
        @dir_ent['name']= filename.ljust(11)
        @name = filename
      end
    end
150186
public static String mainName(String fileName) {
		if (null == fileName) {
			return fileName;
		}
		int len = fileName.length();
		if (0 == len) {
			return fileName;
		}
		if (CharUtil.isFileSeparator(fileName.charAt(len - 1))) {
			len--;
		}

		int begin = 0;
		int end = len;
		char c;
		for (int i = len - 1; i > -1; i--) {
			c = fileName.charAt(i);
			if (len == end && CharUtil.DOT == c) {
				// 查找最后一个文件名和扩展名的分隔符：.
				end = i;
			}
			if (0 == begin || begin > end) {
				if (CharUtil.isFileSeparator(c)) {
					// 查找最后一个路径分隔符（/或者\），如果这个分隔符在.之后，则继续查找，否则结束
					begin = i + 1;
					break;
				}
			}
		}

		return fileName.substring(begin, end);
	}
1124837
function getFilenameWithoutExtension(filename) {
        var index = filename.lastIndexOf(".");
        return index === -1 ? filename : filename.slice(0, index);
    }
263700
def getExistingFile(name, max_suffix=1000):
    
    num = 1
    stem, ext = os.path.splitext(name)
    filename = name
    while not os.path.exists(filename):
        suffix = "-%d" % num
        filename = stem + suffix + ext
        num += 1
        if num >= max_suffix:
            raise ValueError("No file %r found" % name)
    return filename
611352
def filename(self):
        """"""
        if self.value and 'value' in self._json_data and self._json_data['value']:
            return self._json_data['value'].split('/')[-1]
        return None
290432
public static String getSafeFilename(String filename)
   {
      String result = filename;
      if (result != null)
      {
         result = result.replaceAll("[^a-zA-Z0-9]+", "-").replaceAll("^-+", "");
      }
      return result;
   }
49196
public static String getBaseName(String fileName) {
        if (fileName == null)
            return null;

        String[] tokens = split(fileName);
        return tokens[0];
    }
1024632
function getFullFilename(filename) {
  if (p.isAbsolute(filename)) {
    return filename
  }
  return p.join(process.cwd(), filename)
}
927424
function (filename) {
            var stat;
            try { stat = fs.statSync(filename); }
            catch (err) { stat = null; }
            return stat;
        }
677870
def getNonexistingFile(name):
    
    num = 1
    stem, ext = os.path.splitext(name)
    filename = name
    while os.path.exists(filename):
        suffix = "-%d" % num
        filename = stem + suffix + ext
        num += 1
    return filename