
Các hàm UNICODE thông dụng
Thông tin tài liệu:
Nội dung trích xuất từ tài liệu:
Các hàm UNICODE thông dụng Các hàm UNICODE thông d ụngĐổi chữ thường thành chữ hoa:Function UpperUniChar(Ch) As String Return the Uppercase for a given vowel or dd Dim Pos Position of character in Unicode vowel list Locate the character in list of Unicode vowels Pos = InStr(UVowels, Ch) If (Pos > 67) Then UpperUniChar = Ch Its already uppercase - leave it alone ElseIf (Pos > 0) Then Its a Lowercase Unicode Vowel - so get the corresponding Uppercasevowel in the list UpperUniChar = Mid(UVowels, Pos + 67, 1) Else Its just a normal ANSI character UpperUniChar = UCase(Ch) End IfEnd FunctionĐọc Text UNICODE từ filePublic Function ReadTextFile(FileName) As String Write a Unicode String to UTF-16LE Text file Remember to Project | References Microsoft Scripting Runtime to support FileSystemObject & TextStream Dim Fs As FileSystemObject Dim TS As TextStream Create a FileSystem Object Set Fs = CreateObject(Scripting.FileSystemObject) Open TextStream for Input. TriStateTrue means Read Unicode UTF-16LE Set TS = Fs.OpenTextFile(FileName, ForReading, False, TristateTrue) ReadTextFile = TS.ReadAll Read the whole content of the text file in onestroke TS.Close Close the Text Stream Set Fs = Nothing Dispose FileSystem ObjectEnd FunctionViết UNICODE text ra filePublic Sub WriteTextFile(FileName, StrOutText) Read a Unicode String from UTF-16LE Text file Remember to Project | References Microsoft Scripting Runtime to support FileSystemObject & TextStream Dim Fs As FileSystemObject Dim TS As TextStream Create a FileSystem Object Set Fs = CreateObject(Scripting.FileSystemObject) Open TextStream for Output, create file if necesssary TriStateTrue means Write Unicode UTF-16LE Set TS = Fs.OpenTextFile(File Name, ForWriting, True, TristateTrue) TS.Write StrOutText Write the whole StrOutText string in one stroke TS.Close Close the Text Stream Set Fs = Nothing Dispose FileSystem ObjectEnd SubCách gọn và tiện nhất để đọc và viết UTF-8 text files là dùng m ột VB6 Classtên clsUnicodeText d ựa vào MS DOM (Document Object Model) và XML nhưsau:Dim MyUnicodeText As clsUnicodeTextSet MyUnicodeText = New clsUnicodeText Read Unicode Text from file txtFileName and display in TextBox1TextBox1.Text = MyUnicodeText.ReadUnicode(txtFileName)Listing của Class clsUnicodeText nh ư sau:Option ExplicitPrivate mDOMTextFile As DOMDocumentPrivate mXMLPath As StringPublic Function ReadUnicode(TXMLPat h) Dim objTextFileRoot As IXMLDOMElement Set mDOMTextFile = New DOMDocument mXMLPath = TXMLPath mDOMTextFile.Load mXMLPath start at the root element of the XML Set objTextFileRoot = mDOMTextFile.documentElement ReadUnicode = objTextFileRoot. nodeTypedValueEnd FunctionPublic Sub WriteUnicode(OutText, Optional TXMLPath) Dim tDOMNode As IXMLDOMElement Temporary Node for DOM If IsMissing(TXMLPath) Then Save the information on the screen by creating a new element and add itschildren to the DOM object mDOMTextFile.documentElement.Text = OutText Update the XML file mDOMTextFile.save mXMLPath Else Set mDOMTextFile = New DOMDocument Create a Node called Text in DOM Set tDOMNode = mDOMTextFile.createElement(Text) Make it the Root Node mDOMTextFile.appendChild tDOMNode Assign Output Text to Root Node mDOMTextFile.documentElement.Text = OutText Update the XML file mDOMTextFile.save TXMLPath End IfEnd SubNguồn: Vovisoft{/tab}
Tìm kiếm theo từ khóa liên quan:
Javascript ASP.NET Tin học đại cương giáo trình Tin học đại cương bài giảng Tin học đại cương tài liệu Tin học đại cương lý thuyết Tin học đại cươngTài liệu có liên quan:
-
Ứng dụng công cụ Quizizz thiết kế trò chơi học tập trong giảng dạy học phần tin học đại cương
12 trang 310 0 0 -
Tài liệu hướng dẫn thực hành Tin học đại cương - ĐH Bách Khoa Hà Nội
40 trang 263 0 0 -
Giáo trình Tin học đại cương part 7
19 trang 253 0 0 -
Giáo trình Tin học đại cương: Phần 1 - ĐH Kinh tế Quốc Dân
130 trang 182 0 0 -
Giáo trình Tin học đại cương: Phần 2 - Trần Đình Khang
118 trang 157 0 0 -
Giáo trình Tin học đại cương (Tái bản năm 2020): Phần 1 - PGS.TS. Nguyễn Thị Thu Thủy (Chủ biên)
105 trang 147 0 0 -
Hướng dẫn thực hành lập trình C trên Visual Studio
9 trang 138 0 0 -
Giáo trình Tin học đại cương: Phần 1 - Vi Hồng Thắm
90 trang 136 0 0 -
Quản trị người dùng trong Exchange 2007 bằng Powershell
9 trang 112 0 0 -
GIÁO TRÌNH LẬP TRÌNH WEB_PHẦN 2_BÀI 3
3 trang 110 0 0 -
Đề cương học phần Tin học đại cương
23 trang 108 0 0 -
Ngân hàng câu hỏi trắc nghiệm môn tin học đại cương
34 trang 97 0 0 -
Đề cương ôn tập môn: Tin học đại cương ĐHXD
62 trang 85 0 0 -
Bài giảng Tin học đại cương - Lê Thị Thu
110 trang 83 1 0 -
225 trang 76 0 0
-
Bài giảng Tin học đại cương - Chương 1: Các vấn đề cơ bản của Tin học
17 trang 70 0 0 -
Giáo trình Tin học đại cương: Phần 2 - ĐH Kinh tế Quốc Dân
278 trang 68 0 0 -
Đề thi kết thúc học phần Tin học đại cương (năm 2014): Đề 01
10 trang 68 0 0 -
Đề thi tin học trình độ B - Đề số 1
3 trang 67 0 0 -
Giáo trình lập trình trực quan
252 trang 65 0 0