现在又一个字符串eg: str="23,234,343,23422323,23323423"
这个字符串第一个逗号前是两位,最后一个逗号后是8位,中间的位数就不定了
那末我该怎么才能把这个字符串的数值取出呢??????
是以逗号为标志来截取的

解决方案 »

  1.   

    用Split函數
    dim MyVal() as long
    dim i as integer
     Myval=split(str,",")
     for i=0 to  ubound(myval)
      msgbox myval(i)
     next
      

  2.   

    dim arr() as stringarr = split(text1, ",")for i = 0 to Ubound(arr)
       debgu.print trim(arr(i))
    next i
      

  3.   

    dim ss() as string
    dim i as integer
    dim Result as string
     ubound(split(str))    '返回数组的个数
     ss=split(str)
     for i=0 to ubound(split(str))
       Result=result+ss(i)
     next i
      msgbox result    'result则是你要的结果
      

  4.   

    楼上的都说了。用split()函数就行了
      

  5.   

    Split函数返回一个下标从零开始的一维数组,它包含指定数目的子字符串。
      

  6.   

    dim strTemp as string
    dim arrTemp() as string
    dim i as longstrTemp="23,234,343,23422323,23323423"
    arrTemp= Split(strTemp, ",")for i = 0 to Ubound(arrTemp)
       debug.print trim(arrTemp(i))'得到的数
    next i
      

  7.   

    Private Sub Command1_Click()
    Const Str = "23,234,343,23422323,23323423"
    Dim pos As Integer, temp As String
    temp = Str
    Do
    pos = InStr(temp, ",")
    Debug.Print Left(temp, pos - 1)
    temp = Mid(temp, pos + 1)
    Loop Until InStr(temp, ",") = 0
    Debug.Print temp
    End Sub
      

  8.   

    使用Split函数:
    Dim InStr as string
    dim OutArr '我试下来,只有定义为自动变量,才能获得Split分割得到的数组。
    InStr= "23,234,343,23422323,23323423"
    OutArr=Split(InStr,",")
    '这样就可以了。InStr中的字符串已经被分割到OutArr中了。此时OutArr已经被自动转化成一个字符型数组,你可以直接使用:OutArr(0),OutArr(1)等普通数组的操作来访问其内容。
      

  9.   

    非常喜欢 northwolves(狼行天下) 的方法,
    因为狼兄的方法使人开阔视野……