Armin Zingler said:
For which purpose? Trailing blanks in a String cost memory and have no
advantage.
I imagine the OP is reading or writing to a file that has fixed length
fields, rather than delimiters.
Unicode has screwed up the String data type as us old time BASIC programmers
know it. It used to be that Strings were not only used as a sequence of ASCII
characters, but also as a way of storing binary data.
ASCII was 8-bit, but Unicode is (at least) 16-bit, so now instead of the
one-size-fits-all String, we need to use:
String for text
Byte() for binary data
Char() for fixed length strings
However, the syntax is all different for Char() compared to the old
"String*40". You need to use Array.Copy() instead of MID()="value"
So instead of
Dim strFixed as String*40
strFixed = "This is a fun test"
Mid(strFixed,9, 4) = "not a"
MsgBox(strFixed)
we do this
Dim chrFixed() As Char = Space(40).ToCharArray
Array.Copy("This is a fun test".ToCharArray, 0, chrFixed, 0, 18)
Array.Copy("not a".ToCharArray, 0, chrFixed, 8, 5)
MsgBox(CStr(chrFixed))