1. 首页
  2. 编程语言
  3. Delphi
  4. delphi 实现截取字符串中中文+英文混合截取

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

上传者: 2019-06-22 02:48:06上传 RAR文件 3.4KB 热度 72次
Delphi implementation intercepts the Chinese + English mixed intercept in the string
下载地址
用户评论
码姐姐匿名网友 2019-06-22 02:48: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