| | |
Unicode and Strings
Thread Solved |
•
•
Join Date: Jun 2006
Posts: 2
Reputation:
Solved Threads: 0
Given the following two code snippets, how come I get different output? The above produces the following output: second procedure: Which produces this output: My question is: why the additional zeroes from the second procedure? Assigning a string to a byte array fills the byte array with the unicode characters, and I thought this was essentially what the StrConv function did (with vbUnicode option). Can anyone settle my curiosity? Thanks for any/all replies! Richard
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Sub test() Dim str As String Dim b() As Byte str = "hello" b() = str str = "" For i = LBound(b) To UBound(b) str = str & b(i) & " " Next i Debug.Print str End Sub
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
104 0 101 0 108 0 108 0 111 0
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Sub test2() Dim str As String Dim b() As Byte str = "hello" b() = StrConv(str, vbUnicode) str = "" For i = LBound(b) To UBound(b) str = str & b(i) & " " Next i Debug.Print str End Sub
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
104 0 0 0 101 0 0 0 108 0 0 0 108 0 0 0 111 0 0 0
![]() |
Similar Threads
- passing in ascii/unicode strings to LoadLibrary (C++)
- C++ handling of strings in a boolean expression (C++)
- about:blank again sorry tried what ive read and nothing (Viruses, Spyware and other Nasties)
- Compare strings... (C++)
- comparing two strings with linear search.. (Java)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
- JSP and Oracle (JSP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: changing menu control
- Next Thread: question
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






