以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  字幕文件内容如何导入数据库?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=88562)

--  作者:superapple
--  发布时间:2016/8/4 21:41:00
--  字幕文件内容如何导入数据库?
字幕文件内容
1
00:00:04,971 --> 00:00:08,507
( humming )

2
00:00:10,510 --> 00:00:13,145
Oh. Ahem.

3
00:00:13,147 --> 00:00:14,813
Once upon a time--

4
00:00:14,815 --> 00:00:17,649
Oh, I want
to tell it!
Me, too!

如何导入数据库成为如下格式
1  00:00:04,971 --> 00:00:08,507   ( humming )
2  00:00:10,510 --> 00:00:13,145    Oh. Ahem.
3  00:00:13,147 --> 00:00:14,813   Once upon a time--
4  00:00:14,815 --> 00:00:17,649   Oh, I want||to tell it!||Me, too!  此处多行合并成一行,并用||分隔




--  作者:cbt
--  发布时间:2016/8/4 23:39:00
--  

CurrentTable.DataTable.DeleteFor("")
CurrentTable.AddNew(10)
Dim str As String = FileSys.ReadAllText(ProjectPath & "s.txt")
str=str.Replace(vblf,"")
Dim rs() As String = str.Split(vbcr)
Dim 行 As Integer = 0
Dim 列 As Integer =0
Dim 列2 As Integer =0
For i As Integer = 0 To rs.Length -1
    If rs(i).Length > 0 Then
        列2 +=1
        If 列2>3 Then
            CurrentTable.Value(行,列) = CurrentTable.Value(行,列) & "||" & rs(i)
            Continue For
        End If
        CurrentTable.Value(行,列) = rs(i)
        If 列 < 2 Then
            列 +=1
        End If
    Else
        列=0
        列2=0
        行 = 行+1
    End If
Next

 

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目9.rar

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:s.txt

[此贴子已经被作者于2016/8/4 23:54:00编辑过]