我有Visual Basic的這個功課,我明白的代碼是想這樣做,但我不知道該怎麼辦呢字符串和數組
反正這是不完整的代碼
Function GetNextItem(NextLine As String) As String(,)
Dim answer(0, 1) As String
Dim String1, String2 As String
Dim i As Integer = 0 'variable to store what character you are currently looking at
String1 = ""
String2 = ""
'Loop through the string until you hit a comma. Everything before the comma gets added
one character at a time to String1
'Add one more to i so it moves passed the comma
'Loop from that character to the end of the string. Anything left gets added to String2
'First block of the 1x2 array gets String1
'Second block of the 1x2 array gest String2
'The 1x2 array is returned
Return answer
End Function
的說明在評論 我做了一點。我不需要我想要找到一種方法來解決這個問題。 我真的需要這方面的幫助:3
這是VBA還是VB?不同的動物,你說VB,但有VBA標籤。 –
很高興你不想讓我們爲你做你的功課。當您遇到困難時,我們很樂意爲您提供幫助。尋找下一個循環。這是一個起點。 ;-) –
與第一次遇到的逗號相比,您被要求將字符串NextLine減半。 string1包含前面的逗號,string2後面的所有其他內容。兩個字符串以2的數組形式返回 –