Ive started with a shared example from MemoryBlock, then I expand it a bit and there comes a strange thing !
Original example(s):
Dim s As String = "abcde"
Dim mb As MemoryBlock
mb = s
MsgBox(Str(mb.Size)) //displays 5
Returns 5: OK.
Dim a As String
a = mb
Nice !
MsgBox(mb) //displays "abcde"
Works as expected !
My code:
[code]Sub Action() Handles Action
Dim s As String = “abcde”
Dim mb As MemoryBlock
Dim mbStr As String
// Store the string into a MemoryBlock
mb = s
// Convert the MemoryBlock to a String
mbStr = mb
// Report the data
MsgBox “MemoryBlock Properties” + EndOfLine + EndOfLine +_
“Contents: " + mbStr + EndOfLine + _
“Size (in bytes): " + Format(mb.Size,”###,###”)
End Sub[/code]
This code returns the expected information excepted for the EndOfLine
in the Contents
line: I got the Replacing Character !
And I modified the MsgBox
code to:
MsgBox "MemoryBlock Properties" + EndOfLine + EndOfLine +_
"Size (in bytes): " + Format(mb.Size,"###,###") + mbStr + EndOfLine + _
"Contents: "
And I get the same behavior. I even add a second EndOfLine
(the second MsgBox line): the only difference is that I get two times the Replacement Character instead of two EndOfLine
.
Of course, as is, I do not care at all about this strange behavior. But this annoy me elsewhere in my code where I use this transformation technic.
El Capitan 10.11.6
Xojo 2016r1