20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 0.19 0.18 0.10 0.16 0.24 0.21 0.15 0.17 0.20 0.15 0.25 0.21 0.16 0.18 0.17 0.14 0.18 0.16 0.21 0.16 0.20 0.14 0.19 0.19 0.17 0.17 0.22 0.15 0.22 0.16 0.20 0.14 0.18 0.19 0.24 0.19 0.22………(还有很多数据)其中红色部分为需要去除的字符串
20080821 11093 351XLFYQ0712 02 03 3511 3512 3153
蓝色(日期)部分是每天都会变化的,所以不是仅仅只处理这一天的数据是想把红色部分按字符串多少去除,保存为另一个文件万分感谢,有分奉上!!!

解决方案 »

  1.   

    如果前面的位数不变,就用MID截掉.
    Private Sub Command1_Click()
    Dim a As String
    Dim b As String
    a = "20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 0.19 0.18 0.10 0.16 0.24 0.21 0.15 0.17 0.20 0.15 0.25 0.21 0.16 0.18 0.17 0.14 0.18 0.16 0.21 0.16 0.20 0.14 0.19 0.19 0.17 0.17 0.22 0.15 0.22 0.16 0.20 0.14 0.18 0.19 0.24 0.19 0.22"
    b = "20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 "
    a = Mid(a, 49)
    b = Mid(b, 9)
    Debug.Print a
    Debug.Print b
    End Sub
      

  2.   

    mid("20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 0.19 0.18 0.10 0.16 0.24 0.21 0.15 0.17 0.20 0.15 0.25 0.21 0.16 0.18 0.17 0.14 0.18 0.16 0.21 0.16 0.20 0.14 0.19 0.19 0.17 0.17 0.22 0.15 0.22 0.16 0.20 0.14 0.18 0.19 0.24 0.19 0.22",len("20080821 11093 351XLFYQ0712 02 03 3511 3512 3153"))
      

  3.   

    Dim strFile As String
    Dim strA As String
    Private Sub Command2_Click()
     Open "c:\1.txt" For Binary As #1 '你的文件
    strFile = Space(LOF(1))
    Get #1, , strFile
    Close #1
    strA = Mid(Trim(strFile), 50)
    Text1.Text = Text1.Text & strA & vbCrLf
    End Sub
      

  4.   


    Private Sub Form_Load()
    Dim str As String
    Dim lens As Integer
    '原字符串
    str = "20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 0.19 0.18 0.10 0.16 0.24 0.21 0.15 0.17 0.20 0.15 0.25 0.21 0.16 0.18 0.17 0.14 0.18 0.16 0.21 0.16 0.20 0.14 0.19 0.19 0.17 0.17 0.22 0.15 0.22 0.16 0.20 0.14 0.18 0.19 0.24 0.19 0.22"
    Debug.Print str
    '截取的长度
    lens = Len("20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 ")
    Debug.Print lens
    '新字符串
    str = Mid(str, lens, Len(str) - lens)
    Debug.Print str
    End Sub
      

  5.   

    dim reg as new regexp
    reg.multiline = false
    reg.ignorecase = true
    reg.pattern = "^\d{8} \d{5} [0-9A-Z]{12} \d{2} \d{2} \d{4} \d{4} \d{4}"
    msgbox reg.replace("...","")也许用正则表达式更简单和灵活一些.
    (注意:以上代码没有经过调试,只是说了一下大概的处理思路)
      

  6.   

    Dim tmp() As Byte, L As Long, n As LongOpen "source.txt" For Binary As #1
    L = LOF(1)
    n = Len("20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 ")
    Redim tmp(L - n - 1)
    Get #1, n + 1, tmp
    Close #1Open "newfile.txt" For Output As #1
    Put #1, , tmp
    Close #1 
      

  7.   

        Dim s As String, a() As String
        s = "20080821 11093 351XLFYQ0712 02 03 3511 3512 3153 0.19 0.18 0.10 0.16 0.24 0.21 0.15 0.17 0.20 0.15 0.25 0.21 0.16 0.18 0.17 0.14 0.18 0.16 0.21 0.16 0.20 0.14 0.19 0.19 0.17 0.17 0.22 0.15 0.22 0.16 0.20 0.14 0.18 0.19 0.24 0.19 0.22………"
        a = Split(s, " ", 9)
        Debug.Print a(8) '<-这就是去除前缀的部分
      

  8.   

    reg.pattern = "([^ ]+ ){9}"
    也可以实现楼上的效果:-)