Str2Bytes
type TBytes = array of Byte; function Str2Bytes(const S: string): TBytes; var AnsiStr: AnsiString; begin if S = '' then begin Result := nil; // 或者设置为长度为0的数组 Exit; end; AnsiStr := AnsiString(S); SetLength(Result, Length(AnsiStr)); if Length(Result) > 0 then Move(AnsiStr[1], Result[0], Length(AnsiStr)); end;

浙公网安备 33010602011771号