N bytes, taken from a given character string (characters taken to solve distortion problems)

Original link: http://www.cnblogs.com/yzryc/p/6329473.html

function GetNBytesChar(s: Ansistring; n: Integer): string;
var
  aStr: AnsiString;
  bStr: WideString;
begin
  aStr := Copy(s, 1, n);
  bStr := aStr;
  if aStr = bStr then
    Result := astr
  else
    Result := Copy(s, 1, n-1);
end;

Reproduced in: https: //www.cnblogs.com/yzryc/p/6329473.html

Guess you like

Origin blog.csdn.net/weixin_30363509/article/details/94795495