I want to add an invisible character to a text string.
Dim myString As String
myString = "United States"
The following codes are not ok because the following codes separate the string into two parts. I want to keep the string in one part.
myString = "United" & " " & "States"
myString = "United" & Space(1) & "States"
myString = "United" & Chr(32) & "States"
myString = "United" & Chr(160) & "States"
There must be a character between United and States, but that character must be invisible, and it must take up space.
What character should I put in the following string instead of the question mark?
myString = "United?States"
You need to use a zero-width space, . Try:
myString = "United" & ChrW(8203) & "States"
ChrW()
is the Unicode version of Chr()
(which is ASCII). Note that if your implementation doesn't support Unicode, this won't work because ASCII doesn't have a ZWSP character.