1 var 2 3 s,s1: string; 4 5 pw: PWideChar; 6 7 begin 8 9 s:='hello worldxxxx'; 10 11 GetMem(pw,2*length(s)+2); 12 13 pw:=StringToWideChar(s,pw,length(s)+2); 14 15 s1:=WideCharToString(pw); 16 17 edit1.Text:=s1; 18 19 freemem(pw); 20 21 end;
1 var 2 3 s,s1: string; 4 5 pw: PWideChar; 6 7 begin 8 9 s:='hello worldxxxx'; 10 11 GetMem(pw,2*length(s)+2); 12 13 pw:=StringToWideChar(s,pw,length(s)+2); 14 15 s1:=WideCharToString(pw); 16 17 edit1.Text:=s1; 18 19 freemem(pw); 20 21 end;