VB6.0 判断指定字符串出现的次数,判断字符串A在字符串B中出现的次数,使用了VB的Mid函数来判断,如图所示的运行效果,单击按钮即可查看运行结果。代码验证判断部分,采用for循环遍历判断,代码如下:
Dim j As Integer
j = 0
For i = 1 To Len(Text1)
If Mid(Text1, i, Len(Text2)) = Text2 Then
j = j + 1
End If
Next i
Label2.Caption = "出现" & j & "次"
SHOW FULL COLUMNS FROM `jrk_downrecords` [ RunTime:0.001475s ]
SELECT `a`.`aid`,`a`.`title`,`a`.`create_time`,`m`.`username` FROM `jrk_downrecords` `a` INNER JOIN `jrk_member` `m` ON `a`.`uid`=`m`.`id` WHERE `a`.`status` = 1 GROUP BY `a`.`aid` ORDER BY `a`.`create_time` DESC LIMIT 10 [ RunTime:0.064609s ]
SHOW FULL COLUMNS FROM `jrk_tagrecords` [ RunTime:0.001022s ]
SELECT * FROM `jrk_tagrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 20 [ RunTime:0.001147s ]
SHOW FULL COLUMNS FROM `jrk_member` [ RunTime:0.001065s ]
SELECT `id`,`username`,`userhead`,`usertime` FROM `jrk_member` WHERE `status` = 1 ORDER BY `usertime` DESC LIMIT 10 [ RunTime:0.003061s ]
SHOW FULL COLUMNS FROM `jrk_searchrecords` [ RunTime:0.000872s ]
SELECT * FROM `jrk_searchrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 5 [ RunTime:0.003797s ]
SELECT aid,title,count(aid) as c FROM `jrk_downrecords` GROUP BY `aid` ORDER BY `c` DESC LIMIT 10 [ RunTime:0.015436s ]
SHOW FULL COLUMNS FROM `jrk_articles` [ RunTime:0.001233s ]
UPDATE `jrk_articles` SET `hits` = 2 WHERE `id` = 294566 [ RunTime:0.013208s ]