- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 从字符串中提取汉字的函数
{从字符串中提取汉字的函数}
procedure StrToHanZiList(str: string; var List: TStringList);
var
p: PWideChar;
begin
if List = nil then List := TStringList.Create;
List.Clear;
{去除重复}
List.Sorted := True;
List.Duplicates := dupIgnore;
p := PWideChar(str);
while p^ <> #0 do
begin
case p^ of
#$4E00..#$9FA5: List.Add(p^);
end;
Inc(p);
end;
end;