C 獲取副檔名 技術 分享

2021-06-22 00:24:21 字數 554 閱讀 4364

方法一:

string filefullname="d:\onekey.exe";

path.getextension(filefullname);

指定的路徑的副檔名(包含句點「.」)、null

或 string.empty。

如果 path 為 null

,則 getextension 返回 null

。如果 path 不具有副檔名資訊,則 getextension返回 string.empty。

方法二:

/// /// hzfile

/// 獲取指定檔案的副檔名

///

/// 指定檔案的絕對路徑

/// 返回檔案的副檔名,如果擴充套件名為空或檔案路徑錯誤則返回空

public string getfileextension(string filepath)

}catch (exception ex)

return filepathextension;

}

php獲取副檔名

第一種 123 4567 891011 1213 1415 獲取副檔名 substr strrchr name.txt 1 function fileextension fstr file extension fileextension abc def.g 123 print r file exte...

PHP獲取副檔名

第一種 tok strtok string,使用strtok將字串分割成乙個個令牌 while tok count count arr i count 1 file type arr i 第二種 arr explode string 使用explode 函式分割字串,返回值是乙個陣列 count c...

php獲取 副檔名

1 str as.da.efg 2 獲取檔案字尾名 3 strrchr 查詢指定字元在字串中的最後一次出現 4echo substr strrchr str,1 5 67 strrpos 計算指定字串在目標字串中最後一次出現的位置 8echo substr str,strrpos str,1 9 1...