VB中有没有函数可检测字符串中的数字并提取出来?

解决方案 »

  1.   

    好像没有听说,自己做一个循环,用 isnumeric()来判断
      

  2.   

    可以判断一下:因为数字9个,用ASCII码就可以了
    简单
      

  3.   

    用instr(),和isnumeric()配合使用应该可以的
      

  4.   

    Private Sub Command1_Click()
        Dim i As Integer
        For i = 1 To Len(Trim(Text1.Text))
            If IsNumeric(Mid(Text1.Text, i, 1)) Then
                MsgBox Mid(Text1.Text, i, 1)
            End If
        Next i
    End Sub
      

  5.   

    Private Sub Command1_Click()
        Dim i As Integer
        dim s as string
        dim shuzi as string
        
        for i=1 to len(s)
           if asc(mid(s,i,1))>=48 and asc(mid(s,i,1))<=57 then 
              shuzi=shuzi & mid(s,i,1)
           endif
        next i
        msgbox shuzi
    end sub