vb编一子过程maxlength(s,maxword),在已知的字符串s中,找出最长的单词maxword,字符串内用空格分隔单词。 5
哪里出错了?PrivateSubCommand1_Click()DimmaxwordAsStringmaxlengthText1&"",maxwordText2=maxw...
哪里出错了?
Private Sub Command1_Click()
Dim maxword As String
maxlength Text1 & "", maxword
Text2 = maxword
End Sub
Sub maxlength(s As String, maxword As String)
Dim word As String
maxword = ""
Do While s <> ""
i = InStr(s, " ")
word = Left(s, i - 1)
If Len(word) > Len(maxword) Then maxword = word
s = Mid(s, i + 1)
Loop
End Sub 展开
Private Sub Command1_Click()
Dim maxword As String
maxlength Text1 & "", maxword
Text2 = maxword
End Sub
Sub maxlength(s As String, maxword As String)
Dim word As String
maxword = ""
Do While s <> ""
i = InStr(s, " ")
word = Left(s, i - 1)
If Len(word) > Len(maxword) Then maxword = word
s = Mid(s, i + 1)
Loop
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询