•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 422,998 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,878 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 1442 | Replies: 3 | Solved
![]() |
•
•
Join Date: Jun 2006
Posts: 2
Reputation:
Rep Power: 0
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
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
104 0 101 0 108 0 108 0 111 0
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
104 0 0 0 101 0 0 0 108 0 0 0 108 0 0 0 111 0 0 0
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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



Linear Mode