2011年7月13日 星期三

VB6拆字串

1.很累的作法:


   t = UCase(Trim$(Command$))
   oNum = Mid(t, 1, InStr(t, ",") - 1)
   oText = Mid(t, InStr(t, ",") + 1, Len(t))


2.比較簡單的作法:
    cmdStr = UCase(Trim$(Command$))
    Dim str() As String
    str = Split(cmdStr, ",")
    oNum = str(0)
    oText = str(1)

沒有留言:

張貼留言