其他分享
首页 > 其他分享> > unicodestring和rawbytestring相互转换

unicodestring和rawbytestring相互转换

作者:互联网

unicodestring和rawbytestring相互转换

function unicode2raw(v: UnicodeString): RawByteString;
begin
SetLength(Result, length(v) shl 1);
Move(PUnicodeString(v)^, PRawByteString(result)^, Length(Result));
end;

function raw2unicode(v: RawByteString): UnicodeString;
begin
var len: Integer := Length(v);
SetLength(Result, len shr 1);
Move(PRawByteString(v)^, PUnicodeString(Result)^, len);
end;

  

标签:function,转换,PUnicodeString,RawByteString,len,rawbytestring,Result,unicodestring
来源: https://www.cnblogs.com/hnxxcxg/p/13984273.html