比如我有字符串:“dld¥334”
我要取出在字符"¥"后数字,怎么个取法,当然在"¥ "字符前面的字符是不确定的。
谢谢帮忙

解决方案 »

  1.   

    使用instr函数,写了一个大概,你试试。
    例如:
    dim a as string
    dim b as string 
    dim iLen as integer
    a="dld¥334"
    iLen = instr(a,"¥")
    if iLen >0 then
       b=left(a,iLen)
    else
       magbox "没有找到钱数。","提示信息" 
    end if
      

  2.   

    哦,写错了,sorry
    应该把b=left(a,iLen)
    改成b=right(a,len(a)-iLen)
    试试
      

  3.   

    uStr = "dld¥334"
        Num = Mid(uStr, InStr(uStr, "¥") + 1)
        Debug.Print Num
      

  4.   

    for i=1 to len("dld¥334")
       if mid("dld¥334",i,1)=“¥” then  strnew=right("dld¥334",len(“dld¥334”)-i)
    next i
    基本就是这个意思啊,你看msdn中的mid用法,自己琢磨一下
      

  5.   

    建议你直接将它封装成一个函数,便于操作。
    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 = instr(a,"¥")
    if iLen >0 then
       b=right(a,len(a)-iLen)
    else
       magbox "没有找到钱数。","提示信息" 
    end if
    convert=b
    end function
      

  6.   

    變量說明:
    -----------------------------------
    str1: 存放預設字符串
    str2: 存放"¥"字符
    str3: 存放結果
    s1  : 存放"¥"字符所在str1中的位置
    -----------------------------------Dim str1,str2,str3 as string
    Dim s1 as int str1="dld¥334"
    str2="¥"s1=instr(1,str2,str1)           '找出¥所在str1中的位置,暫存于s1
    str3=mid(str1,s1+1,len(str1))   '截取str1中¥后面的字符存放于str3希望能幫到你.