用li_id 标识是否未汉字的前半个字符li_id = 1 //我查过很多资料,汉字理论上是从128开始,但国标码实际是从A0开始 if asc(ls_char) >= 160 and li_id = 1 then //回退一个字符 ll_c = ll_c - 1 li_id = 0 end if Just a example ,自己研究吧
此問題我在報表自定義控制中使用如下方式: 先定義一過程: function IsHz(Source: string): Bool; begin result := ((Word(Source[1]) shl 8 + Word(Source[2])) >= $B0A1) and ((Word(Source[1]) shl 8 + Word(Source[2])) <= $D7F9) end; 實際運用中判斷: var Text,s:string;s:=copy(Text,11,1); if (Trim(S)<>'') and IsHz(s) or (Ord(s[1]) >=128) and (copy(v,6,1)<>'(') then begin ......... end;你在實際運用中再根據你的需求改一下
PB 中没有处理 Unicode 字符串的东西吗?用它应该可以。
//我查过很多资料,汉字理论上是从128开始,但国标码实际是从A0开始
if asc(ls_char) >= 160 and li_id = 1 then
//回退一个字符
ll_c = ll_c - 1
li_id = 0
end if
Just a example ,自己研究吧
就是不能阶段的啦
先定義一過程:
function IsHz(Source: string): Bool;
begin
result := ((Word(Source[1]) shl 8 + Word(Source[2])) >= $B0A1)
and ((Word(Source[1]) shl 8 + Word(Source[2])) <= $D7F9)
end;
實際運用中判斷:
var Text,s:string;s:=copy(Text,11,1);
if (Trim(S)<>'') and IsHz(s) or (Ord(s[1]) >=128)
and (copy(v,6,1)<>'(') then
begin
.........
end;你在實際運用中再根據你的需求改一下
http://asp3.6to23.com/dever/delphi/op/op003.asp更多信息:欢迎访问我的个人技术站点
http://dever.6to23.com