.net词库转换器怎么实现
这篇文章主要介绍“.net词库转换器怎么实现”,在日常操作中,相信很多人在.net词库转换器怎么实现问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”.net词库转换器怎么实现”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
成都创新互联公司成立于2013年,我们提供高端重庆网站建设、成都网站制作、成都网站设计、网站定制、营销型网站建设、小程序制作、微信公众号开发、成都网站推广服务,提供专业营销思路、内容策划、视觉设计、程序开发来完成项目落地,为成都纱窗企业提供源源不断的流量和订单咨询。
原理很简单,看看就懂:)
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
到此,关于“.net词库转换器怎么实现”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
本文标题:.net词库转换器怎么实现
网站网址:http://ybzwz.com/article/pijhgs.html