public function getfilename(sfile as string) as string
'傳入帶全路徑的字串,返回檔名
dim i as long, s as string, s1 as string
s1 = strreverse(sfile)
for i = 1 to len(sfile)
s = mid(s1, i, 1)
if s = "/" then
getfilename = strreverse(left(s1, i - 1))
exit for
end if
next
end function
public function getfilepath(sfile as string) as string
'傳入帶全路徑的字串,返回檔案路徑
dim i as long, ss() as string
ss = split(sfile , "/") i = len(ss(ubound(ss)))
getfilepath= left(sfile , len(sfile ) - i)
end function
方法二:
用instrrev函式
描述返回乙個字串在另乙個字串中出現的位置,從字串的末尾算起。
public
function
getfilepath(sfile as string) as string
'傳入帶全路徑的字串,返回檔案路徑
dimi
aslongi =
instrrev
(sfile, "/
")getfilepath =
left
(sfile, i -1
)end function
分解全路徑的檔名,字串
break a path name into components.void splitpath constchar path,char drive,char dir,char fname,char ext void wsplitpath constwchar t path,wchar t driv...
PHP解析析全路徑字串
解析路徑字串 path parts pathinfo var www html ledad5.2modifyconfig filemodifycloudfile.php echo path parts dirname 檔案路徑中的目錄部分 echo path parts basename 檔案路徑中...
orderBy 傳入屬性的字串
ienumerable下面的的orderby可以用於集合的排序。public static iorderedenumerableorderby this ienumerablesource,funckeyselector 他需要傳入乙個 即通過資料返回排序key的 常見的用法 var s new l...