此函数从字符串中分离出路径 Function ParsePath (sPathIn As String) As String Dim I As Integer For I = Len(sPathIn) To 1 Step -1 If InStr(":\", Mid$(sPathIn, I, 1)) Then Exit For Next ParsePath = Left$(sPathIn, I) End Function 此函数从字符串
此函数从字符串中分离出路径
Function ParsePath (sPathIn As String) As String
Dim I As Integer
For I = Len(sPathIn) To 1 Step -1
If InStr(":\", Mid$(sPathIn, I, 1)) Then Exit For
Next
End Function
此函数从字符串中分离出文件名
Function ParseFileName (sFileIn As String) As String
Dim I As Integer
For I = Len(sFileIn) To 1 Step -1
If InStr("\", Mid$(sFileIn, I, 1)) Then Exit For
Next
ParseFileName = Mid$(sFileIn, I + 1, Len(sFileIn) - I)
End Function
此函数从字符串中分离出文件扩展名
Function GetFileExt (sFileName As String) As String
Dim P As Integer
For P = Len(sFileName) To 1 Step -1
If InStr(".", Mid$(sFileName, P, 1)) Then Exit For
Next
GetFileExt = Right$(sFileName, Len(sFileName) - P)
End Function
原文转自:http://www.ltesting.net
联系客服