注册 登录
编程论坛 VB6论坛

求循环节长度的程序

ysr2857 发布于 5 天前 19:27, 45 次点击
代码如下(仅供参考,有更好的程序欢迎沟通探讨):

Private Sub Command1_Click()
'求循环节长度的程序,循环节必须大于5
Dim s As String
s = Text1
s1 = Mid(s, 1, 5)

For j = 6 To Len(s)
If s1 = Mid(s, j, 5) Then
s2 = 1
js = j
Exit For
End If

Next
If s2 = 1 Then
Text2 = "循环节长度" & js - 1 & "  循环节: “" & s1 & "……" & Mid(s, js - 1, 1) & "” "
Else
Text2 = "不循环"
End If

End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""

End Sub
0 回复
1