var ss,s: string; begin ss := 'CodeGear Delphi 2007'; SetString(s,PChar(ss),4); ShowMessage(s); {Code} end;System 单元下的公用函数目录
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;