delphi 实现截取字符串中中文+英文混合截取

FishLiuW 70 0 RAR 2019-06-22 02:06:06

Delphi implementation intercepts the Chinese + English mixed intercept in the string

用户评论
请输入评论内容
评分:
Generic placeholder image 卡了网匿名网友 2019-06-22 02:06:06

就是这段东西,就收5分,不值, procedure TForm1.Button1Click(Sender: TObject); var s, s1, s2: string; begin s := 'z哈哈123aaa'; s1 := Copy(s, 1, 2); ShowMessage(s1); if ByteType(s, 2) = mbLeadByte then // 如果是汉字的第一个字符,需要往后移动一位 begin s1 := Copy(s, 1, 3); end; if ByteType(s, 5) = mbTrailByte