您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇文章主要介绍“.net词库转换器怎么实现”,在日常操作中,相信很多人在.net词库转换器怎么实现问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”.net词库转换器怎么实现”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
原理很简单,看看就懂:)
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词库转换器怎么实现”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。