Home > Software engineering >  For help, how in the middle of the Chinese characters in a line of characters and the Chinese charac
For help, how in the middle of the Chinese characters in a line of characters and the Chinese charac

Time:10-09

For help, how in the middle of the Chinese characters in a line of characters and the Chinese characters insert characters?
Save table on the page as a text file, but save file after each row in the table is each line of characters, no delimiters, want to do a VB program, in the middle of the Chinese characters and the Chinese characters
Hand insert Spaces, please feel free to comment,

CodePudding user response:

In VB, Chinese and western languages are treated as a "character", as a result, you simply by character retrieval, as ASCII from positive to negative or vice versa, insert a space,

CodePudding user response:

 Dim strSource As String, strResult As String, I As an Integer 
Dim lastAsc As Integer

StrSource="Chinese characters, Chinese Character es letters ABC"

For I=1 To Len (strSource)
If I & gt; 1 Then
If ((lastAsc & gt;=0) And (Asc (Mid (strSource, I, 1))) & lt; 0) Or ((lastAsc & lt; 0) And (Asc (Mid (strSource, I, 1))) & gt;=0) And Mid (strSource, I, 1) & lt;> "" Then
StrResult=strResult & amp; "
"End the If
End the If
StrResult=strResult & amp; Mid (strSource, I, 1)
LastAsc=Asc (Mid (strSource, I, 1))
Next I

MsgBox strResult
  • Related