ez-common-ts/lib/commons/file-util.d.ts
2023-11-12 22:00:29 +08:00

16 lines
621 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 获取文件的后缀名
* @param fileName 文件名
* @returns 文件后缀名
*/
export declare function getFileExt(fileName: string): string;
/**
* 获取文件名
* 该函数接收一个表示文件路径的字符串作为参数,返回该路径中文件名部分。
* 首先查找路径中最后一个斜杠或反斜杠的索引,若未找到则直接返回路径;
* 若找到则使用substring方法提取最后一个斜杠或反斜杠后面的字符串作为文件名并返回。
* @param path 文件路径
* @returns 文件名
*/
export declare function getFileName(path: string): string;