vb获取数字问题

来源:百度知道 编辑:UC知道 时间:2024/06/23 01:30:38
text1里面的数据是23564.txt如何用VB只获取前面的数字,也就是23564????

从字符串中分离文件路径,文件名及其扩展名

此函数从字符串中分离出路径
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 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