這篇文章主要介紹“.net詞庫轉(zhuǎn)換器怎么實(shí)現(xiàn)”,在日常操作中,相信很多人在.net詞庫轉(zhuǎn)換器怎么實(shí)現(xiàn)問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”.net詞庫轉(zhuǎn)換器怎么實(shí)現(xiàn)”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!
成都創(chuàng)新互聯(lián)公司成立于2013年,我們提供高端重慶網(wǎng)站建設(shè)、成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、網(wǎng)站定制、營銷型網(wǎng)站建設(shè)、小程序制作、微信公眾號開發(fā)、成都網(wǎng)站推廣服務(wù),提供專業(yè)營銷思路、內(nèi)容策劃、視覺設(shè)計(jì)、程序開發(fā)來完成項(xiàng)目落地,為成都紗窗企業(yè)提供源源不斷的流量和訂單咨詢。
原理很簡單,看看就懂:)
Imports System.IO Imports System.Text Module BDCWordConverter Sub main() Dim dir As New DirectoryInfo("D:bdcWord") Dim fi As FileInfo() = dir.GetFiles("*.gds") For Each f As FileInfo In fi Dim fs As New FileStream(f.FullName, FileMode.Open) Dim br As New BinaryReader(fs) fs.Position = 12 Dim b01 As Byte() = br.ReadBytes(20) ReDim Preserve b01(27) br.BaseStream.Position = 50 Dim b02 As Byte() = br.ReadBytes(8) b02.CopyTo(b01, 20) Console.WriteLine(f.FullName) Dim fileName As String = New StringBuilder(Encoding.GetEncoding("GB2312").GetChars(b01)).ToString.TrimEnd(CChar(" ")) Console.WriteLine("Processing {0}", fileName) Dim fw As New StreamWriter("D:bdc word" & fileName.TrimEnd(Chr(0)) & ".txt") Dim startPos As Integer = 290 Dim offWord As Integer = 30 Dim offPun As Integer = 30 Dim offMean As Integer = 40 Dim offCourse As Integer = 28 br.BaseStream.Position = 290 Dim Word As String Dim Pun As String Dim Mean As String Do Until br.PeekChar = -1 Dim b1 As Byte() = br.ReadBytes(offWord) Word = New ASCIIEncoding().GetChars(b1) Dim b2 As Byte() = br.ReadBytes(offPun) Pun = New ASCIIEncoding().GetChars(b2) Dim b3 As Byte() = br.ReadBytes(offMean) Mean = New StringBuilder(Encoding.GetEncoding("GB2312").GetChars(b3)).ToString br.ReadBytes(offCourse) fw.WriteLine("""{0}"",""{1}"",""{2}""", Word.TrimEnd(CChar(" ")), Pun.TrimEnd(CChar(" ")), Mean.TrimEnd(CChar(" "))) Loop fs.Flush() fs.Close() Next End Sub End Module
到此,關(guān)于“.net詞庫轉(zhuǎn)換器怎么實(shí)現(xiàn)”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!