Gov_777

MemoryStream

May 27th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.35 KB | None | 0 0
  1. var
  2.   US1, US2: UTF8String;
  3.   MStream: TMemoryStream;
  4. begin
  5.   US1 := AnsiToUtf8(Memo1.Text);
  6.   Memo1.Clear;
  7.   MStream := TMemoryStream.Create;
  8.   MStream.Write(PUTF8String(US1)^, Length(US1));
  9.   SetLength(US2, MStream.Size);
  10.   MStream.Position := 0;
  11.   MStream.Read(PUTF8String(US2)^, MStream.Size);
  12.   Memo1.Text := Utf8ToAnsi(US2);
  13.   MStream.Free;
Add Comment
Please, Sign In to add comment