我刚才有字符串:“dld¥334”
 那假如说我的字符串是"ddl¥334¥445",那该怎么个判断呢??
谢谢

解决方案 »

  1.   

    关键是你要取出所有的对应项吗?用循环吧
    我记得是instrrev函数,具体记不清了,你查查书。
    public function Convert(byval a as string) as string 'dim a as string   '你要转换的字符
    dim b as string 
    dim iLen as integer
    'a="dld¥334"
    b=""
    iLen = instrRev(a,"¥")    '找到最后一个"¥"
    while(ilen>0)
    if iLen >0 then
       msgbox "钱数:" & right(a,len(a)-ilen),"提示信息"
       else
       msgbox "没有找到钱数。","提示信息" 
    end if
    a=left(a,len(a)-ilen)
    iLen = instrRev(a,"¥")   '循环判断
    end loop
    convert=b
    end function
      

  2.   

    instrrev好象是个从最后的一个算起的函数,跟instr的开始地方刚好相反。
      

  3.   

    用split函数按"¥"分割字符串,在返回的数组中挑出你想要的数据。
      

  4.   

    就是要从最后算起
    否则,你的数据就会这样。
    ddl¥334¥445取出来以后是¥334¥445
                ¥445我想你是想取出数据的样子是¥445
                              ¥334

    最好用数组接收就行。
      

  5.   

    呵呵,有些写晕了,同意楼上 qbilbo(风之兄) 
    他的方法更简单。用split函数分拣。
      

  6.   

    对用plit函数!!!!!!!!!!!
      

  7.   

    我簡單地寫一個函數﹐你作為參考.
    如你的要求如為:  "ddl¥334¥445"取第一個¥后面的字符:
    str=get_value("ddl¥334¥445",2,"¥")取第二個¥后面的字符:
    str=get_value("ddl¥334¥445",3,"¥")
    function get_value(word,n,char)
    dim str
    dim s1,s2
    str=word
    s1=instr(1,str,char)         '獲取第一個"¥"符號的位置
    s2=instr(s1+1,str,char)      '獲取第二個"¥"符號的位置    if n=1 then
              get_value=mid(str,1,s1-1)
        else 
              if n=2 then
                  get_value=mid(str,s1+1,s2-s1-1)
          else
             get_value=mid(str,s2+1,len(str))
            end if
         end if
    end function
      

  8.   

    Private Sub Command2_Click()
     Dim t As String
     Dim i() As String
     Dim j As Integer
     t = "ddl¥334¥445"
     i = Split(t, "¥")
     For j = 0 To UBound(i())
       Print i(j)
     Next j
     End Sub