namedajipai 2016-03-01 21:50 采纳率: 94.4%
浏览 1283
已采纳

一个有关于VB字符串算法的问题

Visual Basic判断字符串最大连号数,比如12233444返回3,因为444是三连号

  • 写回答

1条回答 默认 最新

  • threenewbee 2016-03-01 21:59
    关注
     dim n = 0
    dim max = 0
    for i = 2 to len(s)
    if mid(s,i,1)=mid(s,i-1,1) then
        n = n + 1
    else
        if n > max then max = n
        n = 1
    end if
    next
    msgbox max
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?