|
-
Apr 26th, 2000, 03:04 PM
#1
Thread Starter
Member
hey, i can't remember the name of the function that would separate a string depending on a string like ",".. man, kinda hard to explain, someones gotta know tho.
I basically need to get the directory out of a string like "C:\(blabla)\(blabla)\file.txt"... get it? so i'd have "C:\(blabla)\(blabla)"
PLEASE HELP!!
-
Apr 26th, 2000, 03:08 PM
#2
PowerPoster
Split?
...or use a function like this:
Code:
Function SplitCommand(Arg() As String, Text As String, Seperator As String) As Long
Dim Length As Long
Dim Count As Long
Dim Pos As Long
Dim Temp As Long
Count = -1
Pos = 1
ReDim Arg(0)
Length = Len(Text)
While Pos <= Length
Temp = InStr(Pos, Text, Seperator, vbTextCompare)
If Temp = 0 Then
Count = Count + 1
ReDim Preserve Arg(Count)
Arg(Count) = Mid(Text, Pos, Len(Text) - Pos + 1)
Pos = Length + 1
Else
Count = Count + 1
ReDim Preserve Arg(Count)
Arg(Count) = Mid(Text, Pos, Temp - Pos)
Pos = Temp + 1
End If
Wend
GetArgsFast = Count
End Function
-
Apr 26th, 2000, 03:09 PM
#3
PowerPoster
Ah 
I just read the question again.. well, here's one to get the path:
Code:
Function GetPath(iFile As String) As String
Dim Temp As String * 1
Dim A As Long
'Return path of file
For A = Len(iFile) To 1 Step -1
Temp = Mid(iFile, A, 1)
'Path found
If Temp = "\" Or Temp = "/" Then
GetPath = Left(iFile, A)
Exit Function
End If
Next
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|