Vb6 如何找到字符串中的重复数字并在vb中显示它们?
如何从输入字符串中找到重复整数,然后找到这些重复整数的和Vb6 如何找到字符串中的重复数字并在vb中显示它们?,vb6,Vb6,如何从输入字符串中找到重复整数,然后找到这些重复整数的和 到目前为止,我只尝试从字符串中查找整数: Function findInt(ByVal s As String) As String Dim retStr As String Dim i As Integer retStr = "" For i = 1 To Len(s) If Mid(s, i, 1) >= "0" And Mid(s, i, 1) <= "9" Then
到目前为止,我只尝试从字符串中查找整数:
Function findInt(ByVal s As String) As String
Dim retStr As String
Dim i As Integer
retStr = ""
For i = 1 To Len(s)
If Mid(s, i, 1) >= "0" And Mid(s, i, 1) <= "9" Then
retStr = retStr + Mid(s, i, 1)
End If
Next
findInt = retStr
End Function
对不起,我是新来的,也是编程方面的:还不知道这里的情况如何:
谢谢。循环遍历字符串并测试下一个字符是否与当前字符相同
'1 form with:
' 1 textbox control: name=Text1
' 1 command button : name=Command1
Option Explicit
Private Sub Command1_Click()
Caption = FindDoubles(Text1.Text)
End Sub
Private Function FindDoubles(strText As String) As String
Dim lngIndex As Long
Dim strFind As String
Dim strDoubles As String
strDoubles = ""
For lngIndex = 1 To Len(strText) - 1
strFind = Mid$(strText, lngIndex, 1)
If Mid$(strText, lngIndex + 1, 1) = strFind Then
strDoubles = strDoubles & strFind & strFind & " "
End If
Next lngIndex
FindDoubles = strDoubles
End Function
欢迎来到堆栈溢出!请花点时间仔细回顾一下:到目前为止,我只尝试从字符串中查找整数。函数findIntByVal s As String As String Dim retStr As String Dim i As Integer retStr=For i=1 To Lens如果Mids,i,1>=0和Mids,i,1可以显示字符串的示例吗?它只是用户输入的随机整数字符串。例如:2344657789@suncastowner对于字符串2344657789,您希望实现的结果是什么?