http://community.csdn.net/Expert/topic/3087/3087623.xml?temp=.3076898

解决方案 »

  1.   

    Dim s As String
    Dim II As Long
    Dim tmpNum As String
    Dim Count As Longs = "192.168.0.1:1000"
    For II = 1 To Len(s)If Asc(Mid$(s, II, 1)) >= 48 And Asc(Mid$(s, II, 1)) <= 57 Then '是数字,存入临时数字
     tmpNum = tmpNum & Mid$(s, II, 1)
    Else
     Count = Count + Val(tmpNum)
     tmpNum = ""
    End If
    NextIf tmpNum <> "" Then
       Count = Count + Val(tmpNum)
    End If
    MsgBox Count