ndicates whether a byte in a string is a single byte character, the first byte of a double byte character, or the second byte of a double byte character.UnitSysUtilsCategoryMBCS utilitiesfunction ByteType(const S: string; Index: Integer): TMbcsByteType;DescriptionCall ByteType to determine the type of the byte specified by the Index parameter, where 0 specifies the first byte in S, 1 specifies the second byte, and so on.If the system is not using a multi-byte character system (MBCS), ByteType always returns mbSingleByte. Otherwise, ByteType returns mbSingleByte if the indicated byte represents a complete character in S, mbLeadByte if it represents the first byte of a double byte character, and mbTrailByte if it represents the second byte of a double byte character.Note: No checking is done to ensure that Index is less than the length of S. It is the caller's responsibility to ensure that Index is not out of bounds.
TMbcsByteType类型 TMbcsByteType represents the use of a single-byte Char in a string that uses a multi byte character set (MBCS).UnitSysUtilstype TMbcsByteType = (mbSingleByte, mbLeadByte, mbTrailByte);DescriptionTMbcsByteType represents the possible return values of the ByteType and StrByteType functions. Possible values are as follows:Values MeaningmbSingleByte The Char is used to represent an entire character in the string. The value of Char can not be included in the LeadBytes set. mbLeadByte The Char is used to represent the first byte of a double-byte character. The value of Char must be included in the LeadBytes set. mbTrailByte The Char is used to represent the second byte in a double-byte character. There are no a priori restrictions on the value of Char.呵呵,应该看得懂吧,我就不解释了
if bytetype(s,1)=mbLeadByte then showmessage('汉字'); 判断字符串的第一个字符是否是汉字
TMbcsByteType represents the use of a single-byte Char in a string that uses a multi byte character set (MBCS).UnitSysUtilstype TMbcsByteType = (mbSingleByte, mbLeadByte, mbTrailByte);DescriptionTMbcsByteType represents the possible return values of the ByteType and StrByteType functions. Possible values are as follows:Values MeaningmbSingleByte The Char is used to represent an entire character in the string. The value of Char can not be included in the LeadBytes set.
mbLeadByte The Char is used to represent the first byte of a double-byte character. The value of Char must be included in the LeadBytes set.
mbTrailByte The Char is used to represent the second byte in a double-byte character. There are no a priori restrictions on the value of Char.呵呵,应该看得懂吧,我就不解释了
showmessage('汉字');
判断字符串的第一个字符是否是汉字
function ByteType(const S: string; Index: Integer): TMbcsByteType;
返回:mbSingleByte 字母
返回:mbLeadByte 汉字第1个字节
返回:mbTrailByte 汉字第2个字节