第一个字符串A,,,里面有abcdefg,,,第二个字符串B,,,里面有abcdefghizk,,,把第二个字符串里面有的而第一个里面没有的存到一个数组里面,,,请问VB有没有涵数可以完成着个功能~~~!!!请高手指点一下,,,谢谢了~~~!!!
'把下面这段存成".frm"文件,在VB中打开,试试是不是你要的
'(我一天只能贴5个文件,没有能贴的了)
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3060
ClientLeft = 60
ClientTop = 450
ClientWidth = 4845
LinkTopic = "Form1"
ScaleHeight = 3060
ScaleWidth = 4845
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
BackColor = &H8000000B&
Height = 375
Left = 840
Locked = -1 'True
TabIndex = 7
Top = 1560
Width = 3375
End
Begin VB.CommandButton Command1
Caption = "Command1比较"
Height = 495
Left = 1320
TabIndex = 3
Top = 2400
Width = 2295
End
Begin VB.TextBox Text3
BackColor = &H8000000A&
Height = 375
Left = 840
Locked = -1 'True
TabIndex = 2
Top = 1080
Width = 3375
End
Begin VB.TextBox Text2
Height = 375
Left = 840
TabIndex = 1
Text = "15685615374123fgdjksla;fj"
Top = 600
Width = 3375
End
Begin VB.TextBox Text1
Height = 375
Left = 840
TabIndex = 0
Text = "15685615374123"
Top = 120
Width = 3375
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "串2:"
ForeColor = &H000000FF&
Height = 180
Index = 3
Left = 240
TabIndex = 8
Top = 1680
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "串2:"
Height = 180
Index = 2
Left = 240
TabIndex = 6
Top = 720
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "串1:"
ForeColor = &H000000FF&
Height = 180
Index = 1
Left = 240
TabIndex = 5
Top = 1200
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "串1:"
Height = 180
Index = 0
Left = 240
TabIndex = 4
Top = 240
Width = 360
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim str1 As String, str2 As String, str11 As String, str22 As String
Dim intLen As Integer, intI As Integer, intAsc1 As Integer, intAsc2 As Integer
If Len(Trim(Text1)) <> 0 And Len(Trim(Text2)) <> 0 Then
If Len(Trim(Text1)) < Len(Trim(Text2)) Then
intLen = Len(Trim(Text1))
Else
intLen = Len(Trim(Text2))
End If
Debug.Print intLen
For intI = 1 To intLen
If Mid(Text1, intI, 1) <> Mid(Text2, intI, 1) Then
str11 = str11 + Mid(Text1, intI, 1)
str22 = str22 + Mid(Text2, intI, 1)
Debug.Print
End If
Next intI
End If
Text3 = str11
Text4 = str22
End Sub