Home > Back-end >  Delphi programming problem
Delphi programming problem

Time:11-17

Anghua_778899: if ByteType (s, I)=mbSingleByte then use in delphi7, but in delphi2010 bad to use, what's the problem

CodePudding user response:

Because the string is ansistring D7 and 2010 string is unicodestring (similar to the widestring D7)
ANSI next Chinese need 2 bytes of storage, the ansistring minimum unit is 1 byte characters, so there will be a traverse to the half of Chinese characters, so you need to determine whether SingleByte
Unicode is the smallest unit of two characters, that is a Chinese and an English or a number of a character (2 bytes), also won't appear read half of Chinese characters, so don't need such a judgment
And ByteType seems to be the function is to unicode compatible with local ANSI characters retained (Delphi documentation before seen such a sentence)

CodePudding user response:

SB - CSDN reply can't edit
The above said there is a minimum unit is 1 under the wrong unicode characters (2 bytes), not 2 characters
  • Related