System.SetString - 获取字符串

举例:
var
  ss,s: string;
begin
  ss := 'CodeGear Delphi 2007';
  SetString(s,PChar(ss),4);
  ShowMessage(s); {Code}
end;

 
 
 
 
 

 

 
  

var
  s: string;
  arr: array[0..6] of Char;
  i: Integer;
begin
  for i := 0 to 6 do
    arr[i] := Chr(i + 65);

  ShowMessage(arr); {ABCDEFG}

  SetString(s, PChar(@arr), 3);
  ShowMessage(s);   {ABC}
end;

 
 
 
 
 

 

 
  
System 单元下的公用函数目录

你可能感兴趣的:(System.SetString - 获取字符串)