s等于一个字符串如245,其实是一个3为数的数字
b组等于比较字符串如12,比较字符长度就不等了,不过不管选几组,这几组本身都不能有重复的
c组等于比较字符串如58
d组等于比较字符串如47
e组等于比较字符串如30
f组等于比较字符串如6
g组等于比较字符串如9
求h=?
现在要判断a当中的3个数(或者认为3个字符也可以)都和下面哪些组的字符串有相同的,然后输出在这个组重复的个数和组名
按上面举例的
s=245
其中2和b组重复1个
4和d组重复1个
5和c组重复1个
那么h=1b1d1c
如s= 116
那么
1和b组重复2个
6和f组重复1个
h=2b1f
我现在把字符串分解了
For i = 1 To MSFlexGrid1.Rows - 1
s=MSFlexGrid1.TextMatrix(i,1)
str = List2.List(i)
arr = Split(str, ",")
a(1) = arr(0)
a(2) = arr(2)
a(3) = arr(4)
a(4) = arr(6)
a(5) = arr(8)
a(6) = arr(10)
a(7) = arr(1)
a(8) = arr(3)
a(9) = arr(5)
a(10) = arr(7)
a(11) = arr(9)
a(12) = arr(11)
a(1)---a(6)为组名 ,a(7)---a(12)为比较字符
a(1)和比较字符组a(7)对应
a(2)和比较字符组a(8)对应
a(3)和比较字符组a(9)对应
a(4)和比较字符组a(10)对应
a(5)和比较字符组a(11)对应
a(6)和比较字符组a(12)对应
MSFlexGrid1.TextMatrix(i,2)=h
请问老师,这个怎么写
b组等于比较字符串如12,比较字符长度就不等了,不过不管选几组,这几组本身都不能有重复的
c组等于比较字符串如58
d组等于比较字符串如47
e组等于比较字符串如30
f组等于比较字符串如6
g组等于比较字符串如9
求h=?
现在要判断a当中的3个数(或者认为3个字符也可以)都和下面哪些组的字符串有相同的,然后输出在这个组重复的个数和组名
按上面举例的
s=245
其中2和b组重复1个
4和d组重复1个
5和c组重复1个
那么h=1b1d1c
如s= 116
那么
1和b组重复2个
6和f组重复1个
h=2b1f
我现在把字符串分解了
For i = 1 To MSFlexGrid1.Rows - 1
s=MSFlexGrid1.TextMatrix(i,1)
str = List2.List(i)
arr = Split(str, ",")
a(1) = arr(0)
a(2) = arr(2)
a(3) = arr(4)
a(4) = arr(6)
a(5) = arr(8)
a(6) = arr(10)
a(7) = arr(1)
a(8) = arr(3)
a(9) = arr(5)
a(10) = arr(7)
a(11) = arr(9)
a(12) = arr(11)
a(1)---a(6)为组名 ,a(7)---a(12)为比较字符
a(1)和比较字符组a(7)对应
a(2)和比较字符组a(8)对应
a(3)和比较字符组a(9)对应
a(4)和比较字符组a(10)对应
a(5)和比较字符组a(11)对应
a(6)和比较字符组a(12)对应
MSFlexGrid1.TextMatrix(i,2)=h
请问老师,这个怎么写
解决方案 »
- 关于“地址族不支持”的问题,错误代码10047
- 用VB写了一个siemens手机与pc数据交换的软件。
- vsflexgrid.coldatatype如何使用???如何对列的字段类型控制??
- LKOAAspcn.dll求助
- 如何不用MAPI或其他第三方控件,而用WinSock来编写邮件发送程序,smtp服务器需要进行身份认证。
- adodc用法错误
- 求助,VB如果生成两个TEXT内数字范围内的所有正整数,并导入到LISTBOX中
- 请问在VBscript脚本中新的对象以及这个对象的方法和属性如何实现?
- 请问中文字体怎么做的呀?typetrue.
- 怎么才能让Form在任务管理器里的应用程序列表 里不出现呢!?
- VB中使用MSCOM控件实现软件握手的问题,请高手指点!(附解决办法和源代码)
- 求助vb replace问题
Function GetValue(ByVal s As String, arrRule As Variant) As String
Dim buf() As Byte
Dim i As Long, idx As Long
Dim a, tmp
buf = s
ReDim a(UBound(buf) / 2)
For i = 0 To UBound(buf) Step 2
a(i / 2) = arrRule(Chr(buf(i)))
Next
s = Join(a, "")
Do
tmp = Mid(s, 1, 1)
GetValue = GetValue & UBound(Split(s, tmp)) & tmp
s = Replace(s, tmp, vbNullString)
Loop While Len(s)
End FunctionPrivate Sub Command1_Click() Dim arr
arr = Array("e", "b", "b", "e", "d", "c", "f", "7", "c", "g")
Debug.Print GetValue("116", arr)
Debug.Print GetValue("245", arr)
Debug.Print GetValue("632521", arr)
End Sub'结果
2b1f
1b1d1c
1f1e3b1c
Dim s_Number() As String
Dim n As Integer, sum As Integerh = ""
Redim s_Number(1 To Len(s))for i = 1 To Len(s)
s_Number(i) = Mid(s, i, 1)
Next in = Ubound(a)/2
For i = 1 To n
sum = 0
For j = 1 To Ubound(s_Number)
If InStr(1, a(i + n), s_Number(j)) Then sum = sum + 1
Next j
If sum Then h = h & a(i) & sum
Next i