Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6924085
  • 博文数量: 700
  • 博客积分: 10821
  • 博客等级: 上将
  • 技术积分: 12011
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-02 10:41
个人简介

大数据、ML、AI、云计算openstack、Linux、SpringCloud。

文章分类

全部博文(700)

分类: C#/.net

2013-10-07 19:16:17

Because os is english, and chinese lauguage isnt permited to install.  I merely write this passage in english.

prepare:
I know data's perporty
  1:every column's length
  2:column's num
  3:seperator is what
  4:data's figure(num)

http://hiyachen.blog.chinaunix.net
chf@tsinghua.org.cn

real code below.
Private Sub CommandButton1_Click()
     
      Dim txtLine As String * 1000
      Dim ansitxtLine As String * 1000
      Dim insStr As String
     
      Dim outLn As String
      Dim spera As String
                      
      'MsgBox "Start"
      'read old data
      oldcnt = Sheet1.Cells(5, 4)
      fldcnt = Sheet1.Cells(7, 4)
      outfile = Sheet1.Cells(6, 4)
      spera = Sheet1.Cells(8, 4)
      If spera = "chr(44)" Then
            spera = ","
      End If
     
      'MsgBox "oldcnt=" & oldcnt & Chr(10) & _
             "fldcnt=" & fldcnt & Chr(10) & _
             "outFile=" & outfile
     
      Open outfile For Output As #1
      For i = 1 To oldcnt
     
        'read line
        txtLine = Sheet2.Cells(i, 1)
        ansitxtLine = StrConv(txtLine, vbFromUnicode)
       
        'read substr
        For j = 1 To fldcnt
            strsta = Sheet3.Cells(7 + j, 12)
            strlen = Sheet3.Cells(7 + j, 16)
           
            insStr = StrConv(MidB$(ansitxtLine, strsta, strlen), vbUnicode)
           
            If j <> 1 Then
                'outLn = outLn + ","
                outLn = outLn + spera
            End If
            outLn = outLn + insStr
            'MsgBox "insStr=" & insStr
            insStr = ""
           
        Next
       
        Print #1, outLn
        outLn = ""
        'read substr
      Next
      Close
     
End Sub
阅读(3573) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~