Home > Software engineering >  Behind the VB string concatenation, after adding Chinese characters cannot be added.
Behind the VB string concatenation, after adding Chinese characters cannot be added.

Time:10-06


Cycle to strPacket append the string, when the string of characters, can't append on the behind, there are a lot of lines,
For example:
Aaa FFCF FFFC
Ffc FRF GFVF
Chinese characters, Chinese characters
Sxsssxcd
One line read, in strline, after adding the Chinese characters, can't append Sxsssxcd,

CodePudding user response:

Look at the following code output, if can see Chinese characters, that your code has a problem:
 Sub test () 
Dim I As an Integer, w1 As String
W1=""
For I=1 To 10
W1=w1 & amp; The IIf (w1 & lt;> "", vbCrLf," ") & amp; The IIf (I Mod 2=0, "we", CStr (I))
Next
The Debug. Print w1
End Sub

CodePudding user response:

VB6 string concatenation operation & amp;
Whether Chinese or western, mix of Chinese and western, even can be properly connected!

Suggest that the original poster is set a breakpoint, single step tracking, what is wrong with the operation process,

CodePudding user response:


I was 9 to 12, there is no question of procedure can be determined, in the front and rear of the Chinese have these two characters \ u000f \ u000e

CodePudding user response:


I was 9 to 12, there is no question of procedure can be determined, in the front and rear of the Chinese have these two characters \ u000f \ u000e


reference 1st floor Topc008 response:
what look at the following code output, if can see Chinese characters, your code has a problem:
 Sub test () 
Dim I As an Integer, w1 As String
W1=""
For I=1 To 10
W1=w1 & amp; The IIf (w1 & lt;> "", vbCrLf," ") & amp; The IIf (I Mod 2=0, "we", CStr (I))
Next
The Debug. Print w1
End Sub

CodePudding user response:

Control character Shift - In x0e (0) and Shift - Out (0 x0f) on the middle of the characters will be treated with different coding (under the different system may not handling),
So not in accordance with the original Chinese output is very normal!

CodePudding user response:

reference 5 floor Tiger_Zhao reply:
control character Shift - In x0e (0) and Shift - Out (0 x0f) on the middle of the characters will be treated with different coding (under the different system may not handling),
So not in accordance with the original Chinese output is very normal!


All is English is normal, why after adding Chinese can't append the ~

CodePudding user response:

Ask your system, Shift and Shift In - Out of Chinese is how to deal with?
  •  Tags:  
  • API
  • Related