function CutKorAnsiToString(AString: AnsiString; Index: Integer): string;
var
I, nCnt: Integer;
begin
if Length(AString) <= Index then
Result := AString
else begin
nCnt := 0;
for I := 1 to Index do begin
if (Integer(AString[I]) and Integer($80)) = Integer($80) then
Inc(nCnt);
end;
if (nCnt mod 2) = 0 then
Result := Copy(AString, 1, Index)
else
Result := Copy(AString, 1, Index - 1);
end;
end;
반응형