Àðãóìåíòû: strArgument - ñòðîêà, intPosition - ïîëîæåíèå àðãóìåíòà â ñòðîêå
Íàçíà÷åíèå: Âîçâðàùàåò àðãóìåíò èç ñïåöèàëüíûì îáðàçîì îòôîðìàòèðîâàííîé ñòðîêè
Âîçâðàùàåò: Àðãóìåíò
Public Function GetArgument(strArguments As String,intPosition As Integer) As String
On Error Resume Next
Dim intCounter As Integer
Dim iCurrPos As Integer
Dim strSeparator As String
Dim strCurrArg As String
GetArgument = ""
strSeparator = Mid(strArguments, 2, CLng(Left(strArguments, 1)))
strArguments = Mid(strArguments, CLng(Left(strArguments, 1)) + 2)
For intCounter = 1 To intPosition
If strArguments = "" Then Exit Function
iCurrPos = InStr(strArguments, strSeparator)
If iCurrPos > 0 Then
strCurrArg = Left(strArguments, iCurrPos - 1)
strArguments = Mid(strArguments, iCurrPos + Len(strSeparator))
Else
strCurrArg = strArguments
strArguments = ""
End If
Next intCounter
GetArgument = strCurrArg
End Function
Ôîðìàò ñòðîêè:
1~Ïåðâûé àðãóìåíò~Âòîðîé àðãóìåíò~Òðåòèé àðãóìåíò
ãäå:
1-êîëè÷åñòâî çíàêîâ â ðàçäåëèòåëå
~ - ðàçäåëèòåëü
Ïðèìåð: Getargument("1'Ïåðâûé'Âòîðîé",2) âîçâðàùàåò Âòîðîé